diff options
author | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2014-08-08 14:30:41 +0200 |
---|---|---|
committer | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2014-08-12 13:49:54 +0200 |
commit | ab0a50979b9eb4dfa3320eff7e187e41efedf7a9 (patch) | |
tree | 498dfb8a97ff3361a9f7486863a52bb4e26bb898 /chromium/third_party/WebKit/Source/core/platform | |
parent | 4ce69f7403811819800e7c5ae1318b2647e778d1 (diff) |
Update Chromium to beta version 37.0.2062.68
Change-Id: I188e3b5aff1bec75566014291b654eb19f5bc8ca
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Diffstat (limited to 'chromium/third_party/WebKit/Source/core/platform')
49 files changed, 0 insertions, 7597 deletions
diff --git a/chromium/third_party/WebKit/Source/core/platform/CryptoResult.h b/chromium/third_party/WebKit/Source/core/platform/CryptoResult.h deleted file mode 100644 index 45aaef5945b..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/CryptoResult.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef CryptoResult_h -#define CryptoResult_h - -#include "public/platform/WebCrypto.h" -#include "wtf/ThreadSafeRefCounted.h" - -namespace WebCore { - -// Receives notification of completion of the crypto operation. -class CryptoResult : public ThreadSafeRefCounted<CryptoResult> { -public: - virtual ~CryptoResult() { } - - virtual void completeWithError() = 0; - virtual void completeWithBuffer(const blink::WebArrayBuffer&) = 0; - virtual void completeWithBoolean(bool) = 0; - virtual void completeWithKey(const blink::WebCryptoKey&) = 0; - virtual void completeWithKeyPair(const blink::WebCryptoKey& publicKey, const blink::WebCryptoKey& privateKey) = 0; - - blink::WebCryptoResult result() - { - return blink::WebCryptoResult(this); - } -}; - -} // namespace WebCore - -#endif diff --git a/chromium/third_party/WebKit/Source/core/platform/DEPS b/chromium/third_party/WebKit/Source/core/platform/DEPS deleted file mode 100644 index 8f464900d63..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/DEPS +++ /dev/null @@ -1,15 +0,0 @@ -# This file dictates which directories can be included in the source files of this folder. -# Please run Tools/Scripts/check-blink-deps after modifying this file. - -include_rules = [ - "-core", - "+core/platform", - "+dl", - "+skia", - "+third_party", - # platform/ shouldn't depends on core/ but unfortunately does (crbug.com/258901). - # Please don't add anything to this list of exceptions. - "!core/dom", - "!core/fileapi", - "!core/rendering", -] diff --git a/chromium/third_party/WebKit/Source/core/platform/DragImage.cpp b/chromium/third_party/WebKit/Source/core/platform/DragImage.cpp deleted file mode 100644 index f8fe7734277..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/DragImage.cpp +++ /dev/null @@ -1,267 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "core/platform/DragImage.h" - -#include "platform/fonts/Font.h" -#include "platform/fonts/FontCache.h" -#include "platform/fonts/FontDescription.h" -#include "platform/fonts/FontMetrics.h" -#include "platform/geometry/FloatPoint.h" -#include "platform/geometry/FloatRect.h" -#include "platform/geometry/IntPoint.h" -#include "platform/graphics/BitmapImage.h" -#include "platform/graphics/Color.h" -#include "platform/graphics/GraphicsContext.h" -#include "platform/graphics/Image.h" -#include "platform/graphics/ImageBuffer.h" -#include "platform/graphics/skia/NativeImageSkia.h" -#include "platform/text/StringTruncator.h" -#include "platform/text/TextRun.h" -#include "platform/transforms/AffineTransform.h" -#include "platform/weborigin/KURL.h" -#include "skia/ext/image_operations.h" -#include "third_party/skia/include/core/SkCanvas.h" -#include "third_party/skia/include/core/SkMatrix.h" -#include "wtf/PassOwnPtr.h" -#include "wtf/RefPtr.h" -#include "wtf/text/WTFString.h" - -#include <algorithm> - -namespace WebCore { - -const float kDragLabelBorderX = 4; -// Keep border_y in synch with DragController::LinkDragBorderInset. -const float kDragLabelBorderY = 2; -const float kLabelBorderYOffset = 2; - -const float kMaxDragLabelWidth = 300; -const float kMaxDragLabelStringWidth = (kMaxDragLabelWidth - 2 * kDragLabelBorderX); - -const float kDragLinkLabelFontSize = 11; -const float kDragLinkUrlFontSize = 10; - -PassOwnPtr<DragImage> DragImage::create(Image* image, RespectImageOrientationEnum shouldRespectImageOrientation, float deviceScaleFactor) -{ - if (!image) - return nullptr; - - RefPtr<NativeImageSkia> bitmap = image->nativeImageForCurrentFrame(); - if (!bitmap) - return nullptr; - - if (image->isBitmapImage()) { - ImageOrientation orientation = DefaultImageOrientation; - BitmapImage* bitmapImage = toBitmapImage(image); - IntSize sizeRespectingOrientation = bitmapImage->sizeRespectingOrientation(); - - if (shouldRespectImageOrientation == RespectImageOrientation) - orientation = bitmapImage->currentFrameOrientation(); - - if (orientation != DefaultImageOrientation) { - FloatRect destRect(FloatPoint(), sizeRespectingOrientation); - if (orientation.usesWidthAsHeight()) - destRect = destRect.transposedRect(); - - SkBitmap skBitmap; - skBitmap.setConfig( - SkBitmap::kARGB_8888_Config, sizeRespectingOrientation.width(), sizeRespectingOrientation.height()); - if (!skBitmap.allocPixels()) - return nullptr; - - SkCanvas canvas(skBitmap); - canvas.concat(affineTransformToSkMatrix(orientation.transformFromDefault(sizeRespectingOrientation))); - canvas.drawBitmapRect(bitmap->bitmap(), 0, destRect); - - return adoptPtr(new DragImage(skBitmap, deviceScaleFactor)); - } - } - - SkBitmap skBitmap; - if (!bitmap->bitmap().copyTo(&skBitmap, SkBitmap::kARGB_8888_Config)) - return nullptr; - return adoptPtr(new DragImage(skBitmap, deviceScaleFactor)); -} - -static Font deriveDragLabelFont(int size, FontWeight fontWeight, const FontDescription& systemFont) -{ - FontDescription description = systemFont; - description.setWeight(fontWeight); - description.setSpecifiedSize(size); - description.setComputedSize(size); - Font result(description, 0, 0); - result.update(0); - return result; -} - -PassOwnPtr<DragImage> DragImage::create(const KURL& url, const String& inLabel, const FontDescription& systemFont, float deviceScaleFactor) -{ - const Font labelFont = deriveDragLabelFont(kDragLinkLabelFontSize, FontWeightBold, systemFont); - const Font urlFont = deriveDragLabelFont(kDragLinkUrlFontSize, FontWeightNormal, systemFont); - FontCachePurgePreventer fontCachePurgePreventer; - - bool drawURLString = true; - bool clipURLString = false; - bool clipLabelString = false; - - String urlString = url.string(); - String label = inLabel; - if (label.isEmpty()) { - drawURLString = false; - label = urlString; - } - - // First step is drawing the link drag image width. - TextRun labelRun(label.impl()); - TextRun urlRun(urlString.impl()); - IntSize labelSize(labelFont.width(labelRun), labelFont.fontMetrics().ascent() + labelFont.fontMetrics().descent()); - - if (labelSize.width() > kMaxDragLabelStringWidth) { - labelSize.setWidth(kMaxDragLabelStringWidth); - clipLabelString = true; - } - - IntSize urlStringSize; - IntSize imageSize(labelSize.width() + kDragLabelBorderX * 2, labelSize.height() + kDragLabelBorderY * 2); - - if (drawURLString) { - urlStringSize.setWidth(urlFont.width(urlRun)); - urlStringSize.setHeight(urlFont.fontMetrics().ascent() + urlFont.fontMetrics().descent()); - imageSize.setHeight(imageSize.height() + urlStringSize.height()); - if (urlStringSize.width() > kMaxDragLabelStringWidth) { - imageSize.setWidth(kMaxDragLabelWidth); - clipURLString = true; - } else - imageSize.setWidth(std::max(labelSize.width(), urlStringSize.width()) + kDragLabelBorderX * 2); - } - - // We now know how big the image needs to be, so we create and - // fill the background - IntSize scaledImageSize = imageSize; - scaledImageSize.scale(deviceScaleFactor); - OwnPtr<ImageBuffer> buffer(ImageBuffer::create(scaledImageSize)); - if (!buffer) - return nullptr; - buffer->context()->scale(FloatSize(deviceScaleFactor, deviceScaleFactor)); - - const float DragLabelRadius = 5; - const IntSize radii(DragLabelRadius, DragLabelRadius); - IntRect rect(IntPoint(), imageSize); - const Color backgroundColor(140, 140, 140); - buffer->context()->fillRoundedRect(rect, radii, radii, radii, radii, backgroundColor); - - // Draw the text - if (drawURLString) { - if (clipURLString) - urlString = StringTruncator::centerTruncate(urlString, imageSize.width() - (kDragLabelBorderX * 2.0f), urlFont, StringTruncator::EnableRoundingHacks); - IntPoint textPos(kDragLabelBorderX, imageSize.height() - (kLabelBorderYOffset + urlFont.fontMetrics().descent())); - TextRun textRun(urlString); - buffer->context()->drawText(urlFont, TextRunPaintInfo(textRun), textPos); - } - - if (clipLabelString) - label = StringTruncator::rightTruncate(label, imageSize.width() - (kDragLabelBorderX * 2.0f), labelFont, StringTruncator::EnableRoundingHacks); - - IntPoint textPos(kDragLabelBorderX, kDragLabelBorderY + labelFont.pixelSize()); - TextRun textRun(label); - buffer->context()->drawText(urlFont, TextRunPaintInfo(textRun), textPos); - - RefPtr<Image> image = buffer->copyImage(); - return DragImage::create(image.get(), DoNotRespectImageOrientation, deviceScaleFactor); -} - -DragImage::DragImage(const SkBitmap& bitmap, float resolutionScale) - : m_bitmap(bitmap) - , m_resolutionScale(resolutionScale) -{ -} - -DragImage::~DragImage() -{ -} - -void DragImage::fitToMaxSize(const IntSize& srcSize, const IntSize& maxSize) -{ - float heightResizeRatio = 0.0f; - float widthResizeRatio = 0.0f; - float resizeRatio = -1.0f; - IntSize originalSize = size(); - - if (srcSize.width() > maxSize.width()) { - widthResizeRatio = maxSize.width() / static_cast<float>(srcSize.width()); - resizeRatio = widthResizeRatio; - } - - if (srcSize.height() > maxSize.height()) { - heightResizeRatio = maxSize.height() / static_cast<float>(srcSize.height()); - if ((resizeRatio < 0.0f) || (resizeRatio > heightResizeRatio)) - resizeRatio = heightResizeRatio; - } - - if (srcSize == originalSize) { - if (resizeRatio > 0.0f) - scale(resizeRatio, resizeRatio); - return; - } - - // The image was scaled in the webpage so at minimum we must account for that scaling - float scaleX = srcSize.width() / static_cast<float>(originalSize.width()); - float scaleY = srcSize.height() / static_cast<float>(originalSize.height()); - if (resizeRatio > 0.0f) { - scaleX *= resizeRatio; - scaleY *= resizeRatio; - } - - scale(scaleX, scaleY); -} - -void DragImage::scale(float scaleX, float scaleY) -{ - int imageWidth = scaleX * m_bitmap.width(); - int imageHeight = scaleY * m_bitmap.height(); - m_bitmap = skia::ImageOperations::Resize( - m_bitmap, skia::ImageOperations::RESIZE_LANCZOS3, imageWidth, imageHeight); -} - -void DragImage::dissolveToFraction(float fraction) -{ - m_bitmap.setAlphaType(kPremul_SkAlphaType); - SkAutoLockPixels lock(m_bitmap); - - for (int row = 0; row < m_bitmap.height(); ++row) { - for (int column = 0; column < m_bitmap.width(); ++column) { - uint32_t* pixel = m_bitmap.getAddr32(column, row); - *pixel = SkPreMultiplyARGB( - SkColorGetA(*pixel) * fraction, - SkColorGetR(*pixel), - SkColorGetG(*pixel), - SkColorGetB(*pixel)); - } - } -} - -} // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/platform/DragImage.h b/chromium/third_party/WebKit/Source/core/platform/DragImage.h deleted file mode 100644 index a350ad899d6..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/DragImage.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef DragImage_h -#define DragImage_h - -#include "platform/geometry/IntSize.h" -#include "platform/graphics/ImageOrientation.h" -#include "third_party/skia/include/core/SkBitmap.h" -#include "wtf/Forward.h" - -namespace WebCore { - -class FontDescription; -class Image; -class KURL; - -class DragImage { -public: - static PassOwnPtr<DragImage> create(Image*, RespectImageOrientationEnum = DoNotRespectImageOrientation, float deviceScaleFactor = 1); - static PassOwnPtr<DragImage> create(const KURL&, const String& label, const FontDescription& systemFont, float deviceScaleFactor); - ~DragImage(); - - const SkBitmap& bitmap() { return m_bitmap; } - float resolutionScale() const { return m_resolutionScale; } - IntSize size() const { return IntSize(m_bitmap.width(), m_bitmap.height()); } - - void fitToMaxSize(const IntSize& srcSize, const IntSize& maxSize); - void scale(float scaleX, float scaleY); - void dissolveToFraction(float fraction); - -private: - DragImage(const SkBitmap&, float resolutionScale); - - SkBitmap m_bitmap; - float m_resolutionScale; -}; - -} - -#endif // DragImage_h diff --git a/chromium/third_party/WebKit/Source/core/platform/Pasteboard.cpp b/chromium/third_party/WebKit/Source/core/platform/Pasteboard.cpp deleted file mode 100644 index bcf42d5cf4b..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/Pasteboard.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2008, 2009, Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "core/platform/Pasteboard.h" - -#include "core/platform/chromium/ChromiumDataObject.h" -#include "platform/clipboard/ClipboardUtilities.h" -#include "platform/graphics/Image.h" -#include "platform/graphics/skia/NativeImageSkia.h" -#include "platform/weborigin/KURL.h" -#include "public/platform/Platform.h" -#include "public/platform/WebDragData.h" -#include "public/platform/WebString.h" -#include "public/platform/WebURL.h" -#include "wtf/PassRefPtr.h" -#include "wtf/RefPtr.h" - -namespace WebCore { - -Pasteboard* Pasteboard::generalPasteboard() -{ - static Pasteboard* pasteboard = new Pasteboard; - return pasteboard; -} - -Pasteboard::Pasteboard() - : m_buffer(blink::WebClipboard::BufferStandard) -{ -} - -bool Pasteboard::isSelectionMode() const -{ - return m_buffer == blink::WebClipboard::BufferSelection; -} - -void Pasteboard::setSelectionMode(bool selectionMode) -{ - m_buffer = selectionMode ? blink::WebClipboard::BufferSelection : blink::WebClipboard::BufferStandard; -} - -void Pasteboard::writePlainText(const String& text, SmartReplaceOption) -{ - // FIXME: add support for smart replace -#if OS(WIN) - String plainText(text); - replaceNewlinesWithWindowsStyleNewlines(plainText); - blink::Platform::current()->clipboard()->writePlainText(plainText); -#else - blink::Platform::current()->clipboard()->writePlainText(text); -#endif -} - -void Pasteboard::writeImage(Image* image, const KURL& url, const String& title) -{ - ASSERT(image); - - RefPtr<NativeImageSkia> bitmap = image->nativeImageForCurrentFrame(); - if (!bitmap) - return; - - blink::WebImage webImage = bitmap->bitmap(); - blink::Platform::current()->clipboard()->writeImage(webImage, blink::WebURL(url), blink::WebString(title)); -} - -void Pasteboard::writeDataObject(PassRefPtr<ChromiumDataObject> dataObject) -{ - blink::Platform::current()->clipboard()->writeDataObject(dataObject); -} - -bool Pasteboard::canSmartReplace() -{ - return blink::Platform::current()->clipboard()->isFormatAvailable(blink::WebClipboard::FormatSmartPaste, m_buffer); -} - -bool Pasteboard::isHTMLAvailable() -{ - return blink::Platform::current()->clipboard()->isFormatAvailable(blink::WebClipboard::FormatHTML, m_buffer); -} - -String Pasteboard::plainText() -{ - return blink::Platform::current()->clipboard()->readPlainText(m_buffer); -} - -String Pasteboard::readHTML(KURL& url, unsigned& fragmentStart, unsigned& fragmentEnd) -{ - blink::WebURL webURL; - blink::WebString markup = blink::Platform::current()->clipboard()->readHTML(m_buffer, &webURL, &fragmentStart, &fragmentEnd); - if (!markup.isEmpty()) { - url = webURL; - // fragmentStart and fragmentEnd are populated by WebClipboard::readHTML. - } else { - url = KURL(); - fragmentStart = 0; - fragmentEnd = 0; - } - return markup; -} - -void Pasteboard::writeHTML(const String& markup, const KURL& documentURL, const String& plainText, bool canSmartCopyOrDelete) -{ - String text = plainText; -#if OS(WIN) - replaceNewlinesWithWindowsStyleNewlines(text); -#endif - replaceNBSPWithSpace(text); - - blink::Platform::current()->clipboard()->writeHTML(markup, documentURL, text, canSmartCopyOrDelete); -} - -} // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/platform/Pasteboard.h b/chromium/third_party/WebKit/Source/core/platform/Pasteboard.h deleted file mode 100644 index f7fa5845c26..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/Pasteboard.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef Pasteboard_h -#define Pasteboard_h - -#include "public/platform/WebClipboard.h" -#include "wtf/Forward.h" -#include "wtf/Noncopyable.h" -#include "wtf/text/WTFString.h" -#include "wtf/Vector.h" - -namespace WebCore { - -class ChromiumDataObject; -class Image; -class KURL; - -class Pasteboard { - WTF_MAKE_NONCOPYABLE(Pasteboard); WTF_MAKE_FAST_ALLOCATED; -public: - enum SmartReplaceOption { - CanSmartReplace, - CannotSmartReplace - }; - - static Pasteboard* generalPasteboard(); - void writePlainText(const String&, SmartReplaceOption); - void writeImage(Image*, const KURL&, const String& title); - void writeDataObject(PassRefPtr<ChromiumDataObject>); - bool canSmartReplace(); - bool isHTMLAvailable(); - String plainText(); - - // If no data is read, an empty string will be returned and all out parameters will be cleared. - // If applicable, the page URL will be assigned to the KURL parameter. - // fragmentStart and fragmentEnd are indexes into the returned markup that indicate - // the start and end of the returned markup. If there is no additional context, - // fragmentStart will be zero and fragmentEnd will be the same as the length of the markup. - String readHTML(KURL&, unsigned& fragmentStart, unsigned& fragmentEnd); - - void writeHTML(const String& markup, const KURL& documentURL, const String& plainText, bool canSmartCopyOrDelete); - - bool isSelectionMode() const; - void setSelectionMode(bool); - - blink::WebClipboard::Buffer buffer() const { return m_buffer; } - -private: - Pasteboard(); - - blink::WebClipboard::Buffer m_buffer; -}; - -} // namespace WebCore - -#endif // Pasteboard_h diff --git a/chromium/third_party/WebKit/Source/core/platform/animation/AnimationTranslationUtil.cpp b/chromium/third_party/WebKit/Source/core/platform/animation/AnimationTranslationUtil.cpp deleted file mode 100644 index cbb7c79f630..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/animation/AnimationTranslationUtil.cpp +++ /dev/null @@ -1,355 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#include "core/platform/animation/AnimationTranslationUtil.h" - -#include "core/platform/animation/CSSAnimationData.h" -#include "core/platform/animation/KeyframeValueList.h" -#include "platform/LengthFunctions.h" -#include "platform/geometry/FloatSize.h" -#include "platform/graphics/filters/SkiaImageFilterBuilder.h" -#include "platform/transforms/InterpolatedTransformOperation.h" -#include "platform/transforms/Matrix3DTransformOperation.h" -#include "platform/transforms/MatrixTransformOperation.h" -#include "platform/transforms/PerspectiveTransformOperation.h" -#include "platform/transforms/RotateTransformOperation.h" -#include "platform/transforms/ScaleTransformOperation.h" -#include "platform/transforms/SkewTransformOperation.h" -#include "platform/transforms/TransformationMatrix.h" -#include "platform/transforms/TranslateTransformOperation.h" - -#include "public/platform/Platform.h" -#include "public/platform/WebAnimation.h" -#include "public/platform/WebAnimationCurve.h" -#include "public/platform/WebCompositorSupport.h" -#include "public/platform/WebFilterAnimationCurve.h" -#include "public/platform/WebFloatAnimationCurve.h" -#include "public/platform/WebTransformAnimationCurve.h" - -#include "wtf/OwnPtr.h" -#include "wtf/text/CString.h" - -using namespace std; -using namespace blink; - -namespace WebCore { - -void toWebTransformOperations(const TransformOperations& transformOperations, const FloatSize& boxSize, WebTransformOperations* webTransformOperations) -{ - // We need to do a deep copy the transformOperations may contain ref pointers to TransformOperation objects. - for (size_t j = 0; j < transformOperations.size(); ++j) { - switch (transformOperations.operations()[j]->type()) { - case TransformOperation::ScaleX: - case TransformOperation::ScaleY: - case TransformOperation::ScaleZ: - case TransformOperation::Scale3D: - case TransformOperation::Scale: { - ScaleTransformOperation* transform = static_cast<ScaleTransformOperation*>(transformOperations.operations()[j].get()); - webTransformOperations->appendScale(transform->x(), transform->y(), transform->z()); - break; - } - case TransformOperation::TranslateX: - case TransformOperation::TranslateY: - case TransformOperation::TranslateZ: - case TransformOperation::Translate3D: - case TransformOperation::Translate: { - TranslateTransformOperation* transform = static_cast<TranslateTransformOperation*>(transformOperations.operations()[j].get()); - webTransformOperations->appendTranslate(floatValueForLength(transform->x(), boxSize.width()), floatValueForLength(transform->y(), boxSize.height()), floatValueForLength(transform->z(), 1)); - break; - } - case TransformOperation::RotateX: - case TransformOperation::RotateY: - case TransformOperation::Rotate3D: - case TransformOperation::Rotate: { - RotateTransformOperation* transform = static_cast<RotateTransformOperation*>(transformOperations.operations()[j].get()); - webTransformOperations->appendRotate(transform->x(), transform->y(), transform->z(), transform->angle()); - break; - } - case TransformOperation::SkewX: - case TransformOperation::SkewY: - case TransformOperation::Skew: { - SkewTransformOperation* transform = static_cast<SkewTransformOperation*>(transformOperations.operations()[j].get()); - webTransformOperations->appendSkew(transform->angleX(), transform->angleY()); - break; - } - case TransformOperation::Matrix: { - MatrixTransformOperation* transform = static_cast<MatrixTransformOperation*>(transformOperations.operations()[j].get()); - TransformationMatrix m = transform->matrix(); - webTransformOperations->appendMatrix(TransformationMatrix::toSkMatrix44(m)); - break; - } - case TransformOperation::Matrix3D: { - Matrix3DTransformOperation* transform = static_cast<Matrix3DTransformOperation*>(transformOperations.operations()[j].get()); - TransformationMatrix m = transform->matrix(); - webTransformOperations->appendMatrix(TransformationMatrix::toSkMatrix44(m)); - break; - } - case TransformOperation::Perspective: { - PerspectiveTransformOperation* transform = static_cast<PerspectiveTransformOperation*>(transformOperations.operations()[j].get()); - webTransformOperations->appendPerspective(floatValueForLength(transform->perspective(), 0)); - break; - } - case TransformOperation::Interpolated: { - TransformationMatrix m; - transformOperations.operations()[j]->apply(m, boxSize); - webTransformOperations->appendMatrix(TransformationMatrix::toSkMatrix44(m)); - break; - } - case TransformOperation::Identity: - webTransformOperations->appendIdentity(); - break; - case TransformOperation::None: - // Do nothing. - break; - } // switch - } // for each operation -} - -template <class Value, class Keyframe, class Curve> -bool appendKeyframeWithStandardTimingFunction(Curve* curve, double keyTime, const Value* value, const Value* lastValue, blink::WebAnimationCurve::TimingFunctionType timingFunctionType, const FloatSize&) -{ - curve->add(Keyframe(keyTime, value->value()), timingFunctionType); - return true; -} - -template <class Value, class Keyframe, class Curve> -bool appendKeyframeWithCustomBezierTimingFunction(Curve* curve, double keyTime, const Value* value, const Value* lastValue, double x1, double y1, double x2, double y2, const FloatSize&) -{ - curve->add(Keyframe(keyTime, value->value()), x1, y1, x2, y2); - return true; -} - -template <> -bool appendKeyframeWithStandardTimingFunction<TransformAnimationValue, WebTransformKeyframe, WebTransformAnimationCurve>(WebTransformAnimationCurve* curve, double keyTime, const TransformAnimationValue* value, const TransformAnimationValue* lastValue, blink::WebAnimationCurve::TimingFunctionType timingFunctionType, const FloatSize& boxSize) -{ - bool canBlend = !lastValue; - OwnPtr<WebTransformOperations> operations = adoptPtr(Platform::current()->compositorSupport()->createTransformOperations()); - if (!operations) - return false; - toWebTransformOperations(*value->value(), boxSize, operations.get()); - if (!canBlend) { - OwnPtr<WebTransformOperations> lastOperations = adoptPtr(Platform::current()->compositorSupport()->createTransformOperations()); - if (!lastOperations) - return false; - toWebTransformOperations(*lastValue->value(), boxSize, lastOperations.get()); - canBlend = lastOperations->canBlendWith(*operations); - } - if (canBlend) { - curve->add(WebTransformKeyframe(keyTime, operations.release()), timingFunctionType); - return true; - } - return false; -} - -template <> -bool appendKeyframeWithCustomBezierTimingFunction<TransformAnimationValue, WebTransformKeyframe, WebTransformAnimationCurve>(WebTransformAnimationCurve* curve, double keyTime, const TransformAnimationValue* value, const TransformAnimationValue* lastValue, double x1, double y1, double x2, double y2, const FloatSize& boxSize) -{ - bool canBlend = !lastValue; - OwnPtr<WebTransformOperations> operations = adoptPtr(Platform::current()->compositorSupport()->createTransformOperations()); - if (!operations) - return false; - toWebTransformOperations(*value->value(), boxSize, operations.get()); - if (!canBlend) { - OwnPtr<WebTransformOperations> lastOperations = adoptPtr(Platform::current()->compositorSupport()->createTransformOperations()); - if (!lastOperations) - return false; - toWebTransformOperations(*lastValue->value(), boxSize, lastOperations.get()); - canBlend = lastOperations->canBlendWith(*operations); - } - if (canBlend) { - curve->add(WebTransformKeyframe(keyTime, operations.release()), x1, y1, x2, y2); - return true; - } - return false; -} - -bool toWebFilterOperations(const FilterOperations& inOperations, WebFilterOperations* outOperations) -{ - SkiaImageFilterBuilder builder; - FilterOutsets outsets = inOperations.outsets(); - builder.setCropOffset(FloatSize(outsets.left(), outsets.top())); - return builder.buildFilterOperations(inOperations, outOperations); -} - -template <> -bool appendKeyframeWithStandardTimingFunction<FilterAnimationValue, WebFilterKeyframe, WebFilterAnimationCurve>(WebFilterAnimationCurve* curve, double keyTime, const FilterAnimationValue* value, const FilterAnimationValue* lastValue, blink::WebAnimationCurve::TimingFunctionType timingFunctionType, const FloatSize& boxSize) -{ - // FIXME(ajuma): In order to animate pixel-moving filters on the compositor thread, we need - // to update overlap testing to take into account the bounds within which the animation - // will be contained, and we need the compositor to update layer bounds as the animation - // progresses. - if (value->value()->hasFilterThatMovesPixels()) - return false; - OwnPtr<WebFilterOperations> operations = adoptPtr(Platform::current()->compositorSupport()->createFilterOperations()); - if (!toWebFilterOperations(*(value->value()), operations.get())) - return false; - curve->add(WebFilterKeyframe(keyTime, operations.release()), timingFunctionType); - return true; -} - -template <> -bool appendKeyframeWithCustomBezierTimingFunction<FilterAnimationValue, WebFilterKeyframe, WebFilterAnimationCurve>(WebFilterAnimationCurve* curve, double keyTime, const FilterAnimationValue* value, const FilterAnimationValue* lastValue, double x1, double y1, double x2, double y2, const FloatSize& boxSize) -{ - // FIXME(ajuma): In order to animate pixel-moving filters on the compositor thread, we need - // to update overlap testing to take into account the bounds within which the animation - // will be contained, and we need the compositor to update layer bounds as the animation - // progresses. - if (value->value()->hasFilterThatMovesPixels()) - return false; - - OwnPtr<WebFilterOperations> operations = adoptPtr(Platform::current()->compositorSupport()->createFilterOperations()); - if (!toWebFilterOperations(*(value->value()), operations.get())) - return false; - curve->add(WebFilterKeyframe(keyTime, operations.release()), x1, y1, x2, y2); - return true; -} - -template <class Value, class Keyframe, class Curve> -PassOwnPtr<blink::WebAnimation> createWebAnimation(const KeyframeValueList& valueList, const CSSAnimationData* animation, int animationId, double timeOffset, Curve* curve, blink::WebAnimation::TargetProperty targetProperty, const FloatSize& boxSize) -{ - bool alternate = false; - bool reverse = false; - if (animation && animation->isDirectionSet()) { - CSSAnimationData::AnimationDirection direction = animation->direction(); - if (direction == CSSAnimationData::AnimationDirectionAlternate || direction == CSSAnimationData::AnimationDirectionAlternateReverse) - alternate = true; - if (direction == CSSAnimationData::AnimationDirectionReverse || direction == CSSAnimationData::AnimationDirectionAlternateReverse) - reverse = true; - } - - for (size_t i = 0; i < valueList.size(); i++) { - size_t index = reverse ? valueList.size() - i - 1 : i; - const Value* originalValue = static_cast<const Value*>(valueList.at(index)); - const Value* lastOriginalValue = 0; - if (valueList.size() > 1 && ((reverse && index + 1 < valueList.size()) || (!reverse && index > 0))) - lastOriginalValue = static_cast<const Value*>(valueList.at(reverse ? index + 1 : index - 1)); - - const TimingFunction* originalTimingFunction = originalValue->timingFunction(); - - // If there hasn't been a timing function associated with this keyframe, use the - // animation's timing function, if we have one. - if (!originalTimingFunction && animation->isTimingFunctionSet()) - originalTimingFunction = animation->timingFunction(); - - // Ease is the default timing function. - blink::WebAnimationCurve::TimingFunctionType timingFunctionType = blink::WebAnimationCurve::TimingFunctionTypeEase; - - bool isUsingCustomBezierTimingFunction = false; - double x1 = 0; - double y1 = 0; - double x2 = 1; - double y2 = 1; - - if (originalTimingFunction) { - switch (originalTimingFunction->type()) { - case TimingFunction::StepsFunction: - // FIXME: add support for steps timing function. - return nullptr; - case TimingFunction::LinearFunction: - // This doesn't need to be flipped when the animation is reversed. - timingFunctionType = blink::WebAnimationCurve::TimingFunctionTypeLinear; - break; - case TimingFunction::CubicBezierFunction: - { - const CubicBezierTimingFunction* originalBezierTimingFunction = toCubicBezierTimingFunction(originalTimingFunction); - isUsingCustomBezierTimingFunction = true; - x1 = originalBezierTimingFunction->x1(); - y1 = originalBezierTimingFunction->y1(); - x2 = originalBezierTimingFunction->x2(); - y2 = originalBezierTimingFunction->y2(); - if (reverse) { - // When the animation is reversed, we need to swap the - // start and end keyframes, and flip the timing - // function in both x and y. - double x1Old = x1; - double y1Old = y1; - x1 = 1 - x2; - y1 = 1 - y2; - x2 = 1 - x1Old; - y2 = 1 - y1Old; - } - break; - } - default: - ASSERT_NOT_REACHED(); - } // switch - } - - double duration = (animation && animation->isDurationSet()) ? animation->duration() : 1; - double keyTime = originalValue->keyTime() * duration; - - if (reverse) - keyTime = duration - keyTime; - - bool addedKeyframe = false; - if (isUsingCustomBezierTimingFunction) - addedKeyframe = appendKeyframeWithCustomBezierTimingFunction<Value, Keyframe, Curve>(curve, keyTime, originalValue, lastOriginalValue, x1, y1, x2, y2, boxSize); - else - addedKeyframe = appendKeyframeWithStandardTimingFunction<Value, Keyframe, Curve>(curve, keyTime, originalValue, lastOriginalValue, timingFunctionType, boxSize); - - if (!addedKeyframe) - return nullptr; - } - - OwnPtr<blink::WebAnimation> webAnimation = adoptPtr(Platform::current()->compositorSupport()->createAnimation(*curve, targetProperty, animationId)); - - int iterations = (animation && animation->isIterationCountSet()) ? animation->iterationCount() : 1; - webAnimation->setIterations(iterations); - webAnimation->setAlternatesDirection(alternate); - - // If timeOffset > 0, then the animation has started in the past. - webAnimation->setTimeOffset(timeOffset); - - return webAnimation.release(); -} - -PassOwnPtr<blink::WebAnimation> createWebAnimation(const KeyframeValueList& values, const CSSAnimationData* animation, int animationId, double timeOffset, const FloatSize& boxSize) -{ - switch (values.property()) { - case AnimatedPropertyWebkitTransform: { - OwnPtr<WebTransformAnimationCurve> curve = adoptPtr(Platform::current()->compositorSupport()->createTransformAnimationCurve()); - return createWebAnimation<TransformAnimationValue, WebTransformKeyframe, WebTransformAnimationCurve>(values, animation, animationId, timeOffset, curve.get(), blink::WebAnimation::TargetPropertyTransform, FloatSize(boxSize)); - } - - case AnimatedPropertyOpacity: { - OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(Platform::current()->compositorSupport()->createFloatAnimationCurve()); - return createWebAnimation<FloatAnimationValue, WebFloatKeyframe, WebFloatAnimationCurve>(values, animation, animationId, timeOffset, curve.get(), blink::WebAnimation::TargetPropertyOpacity, FloatSize()); - } - - case AnimatedPropertyWebkitFilter: { - OwnPtr<WebFilterAnimationCurve> curve = adoptPtr(Platform::current()->compositorSupport()->createFilterAnimationCurve()); - return createWebAnimation<FilterAnimationValue, WebFilterKeyframe, WebFilterAnimationCurve>(values, animation, animationId, timeOffset, curve.get(), blink::WebAnimation::TargetPropertyFilter, FloatSize(boxSize)); - } - - case AnimatedPropertyBackgroundColor: - case AnimatedPropertyInvalid: - return nullptr; - } - - return nullptr; -} - -} // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/platform/animation/AnimationTranslationUtil.h b/chromium/third_party/WebKit/Source/core/platform/animation/AnimationTranslationUtil.h deleted file mode 100644 index 2c95cdfaac6..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/animation/AnimationTranslationUtil.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef AnimationTranslationUtil_h -#define AnimationTranslationUtil_h - -#include "platform/graphics/filters/FilterOperations.h" -#include "platform/transforms/TransformOperations.h" -#include "public/platform/WebTransformOperations.h" -#include "wtf/PassOwnPtr.h" - -namespace blink { -class WebAnimation; -class WebFilterOperations; -} - -namespace WebCore { - -class KeyframeValueList; -class CSSAnimationData; -class FloatSize; - - -// Translates WebCore animation data into a WebAnimation. If we are unable -// to perform this translation, we return nullptr. This can happen if -// - a steps timing function is used, -// - a property other than AnimatedPropertyWebkitTransform, or AnimatedPropertyOpacity is animated, or -// - a transform animation involves a non-invertable transform. -PassOwnPtr<blink::WebAnimation> createWebAnimation(const KeyframeValueList&, const CSSAnimationData*, int animationId, double timeOffset, const FloatSize& boxSize); - -void toWebTransformOperations(const TransformOperations& inOperations, const FloatSize& boxSize, blink::WebTransformOperations* outOperations); - -bool toWebFilterOperations(const FilterOperations& inOperations, blink::WebFilterOperations* outOperations); -} // namespace WebCore - -#endif // AnimationTranslationUtil_h diff --git a/chromium/third_party/WebKit/Source/core/platform/animation/AnimationTranslationUtilTest.cpp b/chromium/third_party/WebKit/Source/core/platform/animation/AnimationTranslationUtilTest.cpp deleted file mode 100644 index 59dcbe91cea..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/animation/AnimationTranslationUtilTest.cpp +++ /dev/null @@ -1,352 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#include "core/platform/animation/AnimationTranslationUtil.h" - -#include "core/platform/animation/CSSAnimationData.h" -#include "core/platform/animation/KeyframeValueList.h" -#include "platform/geometry/IntSize.h" -#include "platform/graphics/filters/FilterOperations.h" -#include "platform/transforms/Matrix3DTransformOperation.h" -#include "platform/transforms/RotateTransformOperation.h" -#include "platform/transforms/ScaleTransformOperation.h" -#include "platform/transforms/TransformOperations.h" -#include "platform/transforms/TranslateTransformOperation.h" -#include "public/platform/WebAnimation.h" -#include "public/platform/WebFilterOperations.h" -#include "wtf/RefPtr.h" -#include <gmock/gmock.h> -#include <gtest/gtest.h> - -using namespace WebCore; -using namespace blink; - -namespace { - -class WebTransformOperationsMock : public blink::WebTransformOperations { -public: - MOCK_CONST_METHOD1(canBlendWith, bool(const WebTransformOperations&)); - MOCK_METHOD3(appendTranslate, void(double, double, double)); - MOCK_METHOD4(appendRotate, void(double, double, double, double)); - MOCK_METHOD3(appendScale, void(double, double, double)); - MOCK_METHOD2(appendSkew, void(double, double)); - MOCK_METHOD1(appendPerspective, void(double)); - MOCK_METHOD1(appendMatrix, void(const SkMatrix44&)); - MOCK_METHOD0(appendIdentity, void()); - MOCK_CONST_METHOD0(isIdentity, bool()); -}; - -class WebFilterOperationsMock : public blink::WebFilterOperations { -public: - MOCK_METHOD1(appendGrayscaleFilter, void(float)); - MOCK_METHOD1(appendSepiaFilter, void(float)); - MOCK_METHOD1(appendSaturateFilter, void(float)); - MOCK_METHOD1(appendHueRotateFilter, void(float)); - MOCK_METHOD1(appendInvertFilter, void(float)); - MOCK_METHOD1(appendBrightnessFilter, void(float)); - MOCK_METHOD1(appendContrastFilter, void(float)); - MOCK_METHOD1(appendOpacityFilter, void(float)); - MOCK_METHOD1(appendBlurFilter, void(float)); - MOCK_METHOD3(appendDropShadowFilter, void(WebPoint, float, WebColor)); - MOCK_METHOD1(appendColorMatrixFilter, void(SkScalar[20])); - MOCK_METHOD2(appendZoomFilter, void(float, int)); - MOCK_METHOD1(appendSaturatingBrightnessFilter, void(float)); - MOCK_METHOD1(appendReferenceFilter, void(SkImageFilter*)); - MOCK_METHOD0(clear, void()); -}; - -bool animationCanBeTranslated(const KeyframeValueList& values, CSSAnimationData* animation) -{ - IntSize boxSize; - return createWebAnimation(values, animation, 0, 0, boxSize); -} - -TEST(AnimationTranslationUtilTest, createOpacityAnimation) -{ - const double duration = 1; - WebCore::KeyframeValueList values(AnimatedPropertyOpacity); - values.insert(adoptPtr(new FloatAnimationValue(0, 0))); - values.insert(adoptPtr(new FloatAnimationValue(duration, 1))); - - RefPtr<CSSAnimationData> animation = CSSAnimationData::create(); - animation->setDuration(duration); - - EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); -} - -TEST(AnimationTranslationUtilTest, createFilterAnimation) -{ - const double duration = 1; - WebCore::KeyframeValueList values(AnimatedPropertyWebkitFilter); - - FilterOperations operations1; - operations1.operations().append(BasicColorMatrixFilterOperation::create(0.5, FilterOperation::SATURATE)); - values.insert(adoptPtr(new FilterAnimationValue(0, &operations1))); - - FilterOperations operations2; - operations2.operations().append(BasicColorMatrixFilterOperation::create(1.0, FilterOperation::SATURATE)); - values.insert(adoptPtr(new FilterAnimationValue(duration, &operations2))); - - RefPtr<CSSAnimationData> animation = CSSAnimationData::create(); - animation->setDuration(duration); - - EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); -} - -TEST(AnimationTranslationUtilTest, createTransformAnimation) -{ - const double duration = 1; - WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); - - TransformOperations operations1; - operations1.operations().append(TranslateTransformOperation::create(Length(2, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TranslateX)); - values.insert(adoptPtr(new TransformAnimationValue(0, &operations1))); - - TransformOperations operations2; - operations2.operations().append(TranslateTransformOperation::create(Length(4, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TranslateX)); - values.insert(adoptPtr(new TransformAnimationValue(duration, &operations2))); - - RefPtr<CSSAnimationData> animation = CSSAnimationData::create(); - animation->setDuration(duration); - - EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); -} - -TEST(AnimationTranslationUtilTest, createTransformAnimationWithBigRotation) -{ - const double duration = 1; - WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); - - TransformOperations operations1; - operations1.operations().append(RotateTransformOperation::create(0, TransformOperation::Rotate)); - values.insert(adoptPtr(new TransformAnimationValue(0, &operations1))); - - TransformOperations operations2; - operations2.operations().append(RotateTransformOperation::create(270, TransformOperation::Rotate)); - values.insert(adoptPtr(new TransformAnimationValue(duration, &operations2))); - - RefPtr<CSSAnimationData> animation = CSSAnimationData::create(); - animation->setDuration(duration); - - EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); -} - -TEST(AnimationTranslationUtilTest, createTransformAnimationWithBigRotationAndEmptyTransformOperationList) -{ - const double duration = 1; - WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); - - TransformOperations operations1; - values.insert(adoptPtr(new TransformAnimationValue(0, &operations1))); - - TransformOperations operations2; - operations2.operations().append(RotateTransformOperation::create(270, TransformOperation::Rotate)); - values.insert(adoptPtr(new TransformAnimationValue(duration, &operations2))); - - RefPtr<CSSAnimationData> animation = CSSAnimationData::create(); - animation->setDuration(duration); - - EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); -} - -TEST(AnimationTranslationUtilTest, createTransformAnimationWithRotationInvolvingNegativeAngles) -{ - const double duration = 1; - WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); - - TransformOperations operations1; - operations1.operations().append(RotateTransformOperation::create(-330, TransformOperation::Rotate)); - values.insert(adoptPtr(new TransformAnimationValue(0, &operations1))); - - TransformOperations operations2; - operations2.operations().append(RotateTransformOperation::create(-320, TransformOperation::Rotate)); - values.insert(adoptPtr(new TransformAnimationValue(duration, &operations2))); - - RefPtr<CSSAnimationData> animation = CSSAnimationData::create(); - animation->setDuration(duration); - - EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); -} - -TEST(AnimationTranslationUtilTest, createTransformAnimationWithSmallRotationInvolvingLargeAngles) -{ - const double duration = 1; - WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); - - TransformOperations operations1; - operations1.operations().append(RotateTransformOperation::create(270, TransformOperation::Rotate)); - values.insert(adoptPtr(new TransformAnimationValue(0, &operations1))); - - TransformOperations operations2; - operations2.operations().append(RotateTransformOperation::create(360, TransformOperation::Rotate)); - values.insert(adoptPtr(new TransformAnimationValue(duration, &operations2))); - - RefPtr<CSSAnimationData> animation = CSSAnimationData::create(); - animation->setDuration(duration); - - EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); -} - -TEST(AnimationTranslationUtilTest, createTransformAnimationWithNonDecomposableMatrix) -{ - const double duration = 1; - WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); - - TransformationMatrix matrix1; - TransformOperations operations1; - operations1.operations().append(Matrix3DTransformOperation::create(matrix1)); - values.insert(adoptPtr(new TransformAnimationValue(0, &operations1))); - - TransformationMatrix matrix2; - matrix2.setM11(0); - TransformOperations operations2; - operations2.operations().append(Matrix3DTransformOperation::create(matrix2)); - values.insert(adoptPtr(new TransformAnimationValue(duration, &operations2))); - - RefPtr<CSSAnimationData> animation = CSSAnimationData::create(); - animation->setDuration(duration); - - EXPECT_FALSE(animationCanBeTranslated(values, animation.get())); -} - -TEST(AnimationTranslationUtilTest, createTransformAnimationWithNonInvertibleTransform) -{ - const double duration = 1; - WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); - - TransformOperations operations1; - operations1.operations().append(ScaleTransformOperation::create(1, 1, 1, TransformOperation::Scale3D)); - values.insert(adoptPtr(new TransformAnimationValue(0, &operations1))); - - TransformOperations operations2; - operations2.operations().append(ScaleTransformOperation::create(1, 0, 1, TransformOperation::Scale3D)); - values.insert(adoptPtr(new TransformAnimationValue(duration, &operations2))); - - RefPtr<CSSAnimationData> animation = CSSAnimationData::create(); - animation->setDuration(duration); - - EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); -} - -TEST(AnimationTranslationUtilTest, createReversedAnimation) -{ - const double duration = 1; - WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); - - TransformOperations operations1; - operations1.operations().append(TranslateTransformOperation::create(Length(2, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TranslateX)); - values.insert(adoptPtr(new TransformAnimationValue(0, &operations1))); - - TransformOperations operations2; - operations2.operations().append(TranslateTransformOperation::create(Length(4, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TranslateX)); - values.insert(adoptPtr(new TransformAnimationValue(duration, &operations2))); - - RefPtr<CSSAnimationData> animation = CSSAnimationData::create(); - animation->setDuration(duration); - animation->setDirection(CSSAnimationData::AnimationDirectionReverse); - - EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); -} - -TEST(AnimationTranslationUtilTest, createAlternatingAnimation) -{ - const double duration = 1; - WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); - - TransformOperations operations1; - operations1.operations().append(TranslateTransformOperation::create(Length(2, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TranslateX)); - values.insert(adoptPtr(new TransformAnimationValue(0, &operations1))); - - TransformOperations operations2; - operations2.operations().append(TranslateTransformOperation::create(Length(4, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TranslateX)); - values.insert(adoptPtr(new TransformAnimationValue(duration, &operations2))); - - RefPtr<CSSAnimationData> animation = CSSAnimationData::create(); - animation->setDuration(duration); - animation->setDirection(CSSAnimationData::AnimationDirectionAlternate); - animation->setIterationCount(2); - - EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); -} - -TEST(AnimationTranslationUtilTest, createReversedAlternatingAnimation) -{ - const double duration = 1; - WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); - - TransformOperations operations1; - operations1.operations().append(TranslateTransformOperation::create(Length(2, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TranslateX)); - values.insert(adoptPtr(new TransformAnimationValue(0, &operations1))); - - TransformOperations operations2; - operations2.operations().append(TranslateTransformOperation::create(Length(4, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TranslateX)); - values.insert(adoptPtr(new TransformAnimationValue(duration, &operations2))); - - RefPtr<CSSAnimationData> animation = CSSAnimationData::create(); - animation->setDuration(duration); - animation->setDirection(CSSAnimationData::AnimationDirectionAlternateReverse); - animation->setIterationCount(2); - - EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); -} - -TEST(AnimationTranslationUtilTest, transformsWork) -{ - TransformOperations ops; - FloatSize box(100, 200); - WebTransformOperationsMock outOps; - - EXPECT_CALL(outOps, appendTranslate(2, 0, 0)); - EXPECT_CALL(outOps, appendTranslate(2, 60, 0)); - EXPECT_CALL(outOps, appendRotate(0.1, 0.2, 0.3, 200000.4)); - EXPECT_CALL(outOps, appendScale(50.2, 100, -4)); - - ops.operations().append(TranslateTransformOperation::create(Length(2, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TranslateX)); - ops.operations().append(TranslateTransformOperation::create(Length(2, WebCore::Percent), Length(30, WebCore::Percent), TransformOperation::Translate)); - ops.operations().append(RotateTransformOperation::create(0.1, 0.2, 0.3, 200000.4, TransformOperation::Rotate3D)); - ops.operations().append(ScaleTransformOperation::create(50.2, 100, -4, TransformOperation::Scale3D)); - toWebTransformOperations(ops, box, &outOps); -} - -TEST(AnimationTranslationUtilTest, filtersWork) -{ - FilterOperations ops; - WebFilterOperationsMock outOps; - - EXPECT_CALL(outOps, appendSaturateFilter(0.5)); - EXPECT_CALL(outOps, appendGrayscaleFilter(0.2f)); - EXPECT_CALL(outOps, appendSepiaFilter(0.8f)); - EXPECT_CALL(outOps, appendOpacityFilter(0.1f)); - - ops.operations().append(BasicColorMatrixFilterOperation::create(0.5, FilterOperation::SATURATE)); - ops.operations().append(BasicColorMatrixFilterOperation::create(0.2, FilterOperation::GRAYSCALE)); - ops.operations().append(BasicColorMatrixFilterOperation::create(0.8, FilterOperation::SEPIA)); - ops.operations().append(BasicColorMatrixFilterOperation::create(0.1, FilterOperation::OPACITY)); - toWebFilterOperations(ops, &outOps); -} - -} - diff --git a/chromium/third_party/WebKit/Source/core/platform/animation/AnimationValue.h b/chromium/third_party/WebKit/Source/core/platform/animation/AnimationValue.h deleted file mode 100644 index cba337cbf2e..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/animation/AnimationValue.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * Copyright (C) 2013 Intel Corporation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef AnimationValue_h -#define AnimationValue_h - -#include "core/platform/animation/TimingFunction.h" -#include "platform/graphics/filters/FilterOperations.h" -#include "platform/transforms/TransformOperations.h" - -#include "wtf/PassRefPtr.h" -#include "wtf/RefPtr.h" - -namespace WebCore { - -// Base class for animation values (also used for transitions). Here to -// represent values for properties being animated via the GraphicsLayer, -// without pulling in style-related data from outside of the platform directory. -class AnimationValue { - WTF_MAKE_FAST_ALLOCATED; -public: - explicit AnimationValue(double keyTime, PassRefPtr<TimingFunction> timingFunction = 0) - : m_keyTime(keyTime) - , m_timingFunction(timingFunction) - { - } - - virtual ~AnimationValue() { } - - double keyTime() const { return m_keyTime; } - const TimingFunction* timingFunction() const { return m_timingFunction.get(); } - virtual PassOwnPtr<AnimationValue> clone() const = 0; - -private: - double m_keyTime; - RefPtr<TimingFunction> m_timingFunction; -}; - -// Used to store one float value of an animation. -class FloatAnimationValue : public AnimationValue { -public: - FloatAnimationValue(double keyTime, float value, PassRefPtr<TimingFunction> timingFunction = 0) - : AnimationValue(keyTime, timingFunction) - , m_value(value) - { - } - virtual PassOwnPtr<AnimationValue> clone() const OVERRIDE { return adoptPtr(new FloatAnimationValue(*this)); } - - float value() const { return m_value; } - -private: - float m_value; -}; - -// Used to store one transform value in a keyframe list. -class TransformAnimationValue : public AnimationValue { -public: - explicit TransformAnimationValue(double keyTime, const TransformOperations* value = 0, PassRefPtr<TimingFunction> timingFunction = 0) - : AnimationValue(keyTime, timingFunction) - { - if (value) - m_value = *value; - } - virtual PassOwnPtr<AnimationValue> clone() const OVERRIDE { return adoptPtr(new TransformAnimationValue(*this)); } - - const TransformOperations* value() const { return &m_value; } - -private: - TransformOperations m_value; -}; - -// Used to store one filter value in a keyframe list. -class FilterAnimationValue : public AnimationValue { -public: - explicit FilterAnimationValue(double keyTime, const FilterOperations* value = 0, PassRefPtr<TimingFunction> timingFunction = 0) - : AnimationValue(keyTime, timingFunction) - { - if (value) - m_value = *value; - } - virtual PassOwnPtr<AnimationValue> clone() const OVERRIDE { return adoptPtr(new FilterAnimationValue(*this)); } - - const FilterOperations* value() const { return &m_value; } - -private: - FilterOperations m_value; -}; - -} // namespace WebCore - -#endif // AnimationValue_h diff --git a/chromium/third_party/WebKit/Source/core/platform/animation/CSSAnimationData.cpp b/chromium/third_party/WebKit/Source/core/platform/animation/CSSAnimationData.cpp deleted file mode 100644 index 277944ba1d3..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/animation/CSSAnimationData.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#include "config.h" -#include "core/platform/animation/CSSAnimationData.h" - -namespace WebCore { - -CSSAnimationData::CSSAnimationData() - : m_name(initialAnimationName()) - , m_property(CSSPropertyInvalid) - , m_mode(AnimateAll) - , m_iterationCount(initialAnimationIterationCount()) - , m_delay(initialAnimationDelay()) - , m_duration(initialAnimationDuration()) - , m_timingFunction(initialAnimationTimingFunction()) - , m_direction(initialAnimationDirection()) - , m_fillMode(initialAnimationFillMode()) - , m_playState(initialAnimationPlayState()) - , m_delaySet(false) - , m_directionSet(false) - , m_durationSet(false) - , m_fillModeSet(false) - , m_iterationCountSet(false) - , m_nameSet(false) - , m_playStateSet(false) - , m_propertySet(false) - , m_timingFunctionSet(false) - , m_isNone(false) -{ -} - -CSSAnimationData::CSSAnimationData(const CSSAnimationData& o) - : RefCounted<CSSAnimationData>() - , m_name(o.m_name) - , m_property(o.m_property) - , m_mode(o.m_mode) - , m_iterationCount(o.m_iterationCount) - , m_delay(o.m_delay) - , m_duration(o.m_duration) - , m_timingFunction(o.m_timingFunction) - , m_direction(o.m_direction) - , m_fillMode(o.m_fillMode) - , m_playState(o.m_playState) - , m_delaySet(o.m_delaySet) - , m_directionSet(o.m_directionSet) - , m_durationSet(o.m_durationSet) - , m_fillModeSet(o.m_fillModeSet) - , m_iterationCountSet(o.m_iterationCountSet) - , m_nameSet(o.m_nameSet) - , m_playStateSet(o.m_playStateSet) - , m_propertySet(o.m_propertySet) - , m_timingFunctionSet(o.m_timingFunctionSet) - , m_isNone(o.m_isNone) -{ -} - -CSSAnimationData& CSSAnimationData::operator=(const CSSAnimationData& o) -{ - m_name = o.m_name; - m_property = o.m_property; - m_mode = o.m_mode; - m_iterationCount = o.m_iterationCount; - m_delay = o.m_delay; - m_duration = o.m_duration; - m_timingFunction = o.m_timingFunction; - m_direction = o.m_direction; - m_fillMode = o.m_fillMode; - m_playState = o.m_playState; - - m_delaySet = o.m_delaySet; - m_directionSet = o.m_directionSet; - m_durationSet = o.m_durationSet; - m_fillModeSet = o.m_fillModeSet; - m_iterationCountSet = o.m_iterationCountSet; - m_nameSet = o.m_nameSet; - m_playStateSet = o.m_playStateSet; - m_propertySet = o.m_propertySet; - m_timingFunctionSet = o.m_timingFunctionSet; - m_isNone = o.m_isNone; - - return *this; -} - -CSSAnimationData::~CSSAnimationData() -{ -} - -bool CSSAnimationData::animationsMatchForStyleRecalc(const CSSAnimationData* o) const -{ - if (!o) - return false; - - return m_name == o->m_name - && m_playState == o->m_playState - && m_property == o->m_property - && m_mode == o->m_mode - && m_nameSet == o->m_nameSet - && m_playStateSet == o->m_playStateSet - && m_propertySet == o->m_propertySet - && m_isNone == o->m_isNone; -} - -const AtomicString& CSSAnimationData::initialAnimationName() -{ - DEFINE_STATIC_LOCAL(const AtomicString, initialValue, ("none")); - return initialValue; -} - -} // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/platform/animation/CSSAnimationData.h b/chromium/third_party/WebKit/Source/core/platform/animation/CSSAnimationData.h deleted file mode 100644 index 7f6e79ab910..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/animation/CSSAnimationData.h +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (C) 2000 Lars Knoll (knoll@kde.org) - * (C) 2000 Antti Koivisto (koivisto@kde.org) - * (C) 2000 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. - * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#ifndef CSSAnimationData_h -#define CSSAnimationData_h - -#include "CSSPropertyNames.h" -#include "core/platform/animation/TimingFunction.h" -#include "core/rendering/style/RenderStyleConstants.h" -#include "wtf/PassRefPtr.h" -#include "wtf/RefCounted.h" -#include "wtf/text/WTFString.h" - -namespace WebCore { - -class CSSAnimationData : public RefCounted<CSSAnimationData> { -public: - ~CSSAnimationData(); - - static PassRefPtr<CSSAnimationData> create() { return adoptRef(new CSSAnimationData); } - static PassRefPtr<CSSAnimationData> create(const CSSAnimationData* o) { return adoptRef(new CSSAnimationData(*o)); } - - bool isDelaySet() const { return m_delaySet; } - bool isDirectionSet() const { return m_directionSet; } - bool isDurationSet() const { return m_durationSet; } - bool isFillModeSet() const { return m_fillModeSet; } - bool isIterationCountSet() const { return m_iterationCountSet; } - bool isNameSet() const { return m_nameSet; } - bool isPlayStateSet() const { return m_playStateSet; } - bool isPropertySet() const { return m_propertySet; } - bool isTimingFunctionSet() const { return m_timingFunctionSet; } - - // Flags this to be the special "none" animation (animation-name: none) - bool isNoneAnimation() const { return m_isNone; } - // We can make placeholder CSSAnimationData objects to keep the comma-separated lists - // of properties in sync. isValidAnimation means this is not a placeholder. - bool isValidAnimation() const { return !m_isNone && !m_name.isEmpty(); } - - bool isEmpty() const - { - return (!m_directionSet && !m_durationSet && !m_fillModeSet - && !m_nameSet && !m_playStateSet && !m_iterationCountSet - && !m_delaySet && !m_timingFunctionSet && !m_propertySet); - } - - bool isEmptyOrZeroDuration() const - { - return isEmpty() || (m_duration == 0 && m_delay <= 0); - } - - void clearDelay() { m_delaySet = false; } - void clearDirection() { m_directionSet = false; } - void clearDuration() { m_durationSet = false; } - void clearFillMode() { m_fillModeSet = false; } - void clearIterationCount() { m_iterationCountSet = false; } - void clearName() { m_nameSet = false; } - void clearPlayState() { m_playStateSet = AnimPlayStatePlaying; } - void clearProperty() { m_propertySet = false; } - void clearTimingFunction() { m_timingFunctionSet = false; } - - void clearAll() - { - clearDelay(); - clearDirection(); - clearDuration(); - clearFillMode(); - clearIterationCount(); - clearName(); - clearPlayState(); - clearProperty(); - clearTimingFunction(); - } - - double delay() const { return m_delay; } - - enum AnimationMode { - AnimateAll, - AnimateNone, - AnimateSingleProperty - }; - - enum AnimationDirection { - AnimationDirectionNormal, - AnimationDirectionAlternate, - AnimationDirectionReverse, - AnimationDirectionAlternateReverse - }; - AnimationDirection direction() const { return static_cast<AnimationDirection>(m_direction); } - bool directionIsForwards() const { return m_direction == AnimationDirectionNormal || m_direction == AnimationDirectionAlternate; } - - unsigned fillMode() const { return m_fillMode; } - - double duration() const { return m_duration; } - - enum { IterationCountInfinite = -1 }; - double iterationCount() const { return m_iterationCount; } - const AtomicString& name() const { return m_name; } - EAnimPlayState playState() const { return static_cast<EAnimPlayState>(m_playState); } - CSSPropertyID property() const { return m_property; } - TimingFunction* timingFunction() const { return m_timingFunction.get(); } - AnimationMode animationMode() const { return m_mode; } - - void setDelay(double c) { m_delay = c; m_delaySet = true; } - void setDirection(AnimationDirection d) { m_direction = d; m_directionSet = true; } - void setDuration(double d) { ASSERT(d >= 0); m_duration = d; m_durationSet = true; } - void setFillMode(unsigned f) { m_fillMode = f; m_fillModeSet = true; } - void setIterationCount(double c) { m_iterationCount = c; m_iterationCountSet = true; } - void setName(const AtomicString& n) { m_name = n; m_nameSet = true; } - void setPlayState(EAnimPlayState d) { m_playState = d; m_playStateSet = true; } - void setProperty(CSSPropertyID t) { m_property = t; m_propertySet = true; } - void setTimingFunction(PassRefPtr<TimingFunction> f) { m_timingFunction = f; m_timingFunctionSet = true; } - void setAnimationMode(AnimationMode mode) { m_mode = mode; } - - void setIsNoneAnimation(bool n) { m_isNone = n; } - - CSSAnimationData& operator=(const CSSAnimationData& o); - - // return true every CSSAnimationData in the chain (defined by m_next) match - bool operator==(const CSSAnimationData& o) const { return animationsMatchForStyleRecalc(&o); } - bool operator!=(const CSSAnimationData& o) const { return !(*this == o); } - - bool fillsBackwards() const { return m_fillModeSet && (m_fillMode == AnimationFillModeBackwards || m_fillMode == AnimationFillModeBoth); } - bool fillsForwards() const { return m_fillModeSet && (m_fillMode == AnimationFillModeForwards || m_fillMode == AnimationFillModeBoth); } - -private: - CSSAnimationData(); - explicit CSSAnimationData(const CSSAnimationData&); - - // Return whether this object matches another CSSAnimationData object for - // the purposes of style recalc. This excludes some properties. - bool animationsMatchForStyleRecalc(const CSSAnimationData*) const; - - AtomicString m_name; - CSSPropertyID m_property; - AnimationMode m_mode; - double m_iterationCount; - double m_delay; - double m_duration; - RefPtr<TimingFunction> m_timingFunction; - unsigned m_direction : 2; // AnimationDirection - unsigned m_fillMode : 2; - - unsigned m_playState : 2; - - bool m_delaySet : 1; - bool m_directionSet : 1; - bool m_durationSet : 1; - bool m_fillModeSet : 1; - bool m_iterationCountSet : 1; - bool m_nameSet : 1; - bool m_playStateSet : 1; - bool m_propertySet : 1; - bool m_timingFunctionSet : 1; - - bool m_isNone : 1; - -public: - static double initialAnimationDelay() { return 0; } - static AnimationDirection initialAnimationDirection() { return AnimationDirectionNormal; } - static double initialAnimationDuration() { return 0; } - static unsigned initialAnimationFillMode() { return AnimationFillModeNone; } - static double initialAnimationIterationCount() { return 1.0; } - static const AtomicString& initialAnimationName(); - static EAnimPlayState initialAnimationPlayState() { return AnimPlayStatePlaying; } - static CSSPropertyID initialAnimationProperty() { return CSSPropertyInvalid; } - static const PassRefPtr<TimingFunction> initialAnimationTimingFunction() { return CubicBezierTimingFunction::preset(CubicBezierTimingFunction::Ease); } -}; - -} // namespace WebCore - -#endif // CSSAnimationData_h diff --git a/chromium/third_party/WebKit/Source/core/platform/animation/CSSAnimationDataList.cpp b/chromium/third_party/WebKit/Source/core/platform/animation/CSSAnimationDataList.cpp deleted file mode 100644 index 5170e7680f9..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/animation/CSSAnimationDataList.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#include "config.h" -#include "core/platform/animation/CSSAnimationDataList.h" - -namespace WebCore { - -#define FILL_UNSET_PROPERTY(test, propGet, propSet) \ -for (i = 0; i < size() && animation(i)->test(); ++i) { } \ -if (i < size() && i != 0) { \ - for (size_t j = 0; i < size(); ++i, ++j) \ - animation(i)->propSet(animation(j)->propGet()); \ -} - -CSSAnimationDataList::CSSAnimationDataList(const CSSAnimationDataList& o) -{ - for (size_t i = 0; i < o.size(); ++i) - m_animations.append(CSSAnimationData::create(o.animation(i))); -} - -void CSSAnimationDataList::fillUnsetProperties() -{ - size_t i; - FILL_UNSET_PROPERTY(isDelaySet, delay, setDelay); - FILL_UNSET_PROPERTY(isDirectionSet, direction, setDirection); - FILL_UNSET_PROPERTY(isDurationSet, duration, setDuration); - FILL_UNSET_PROPERTY(isFillModeSet, fillMode, setFillMode); - FILL_UNSET_PROPERTY(isIterationCountSet, iterationCount, setIterationCount); - FILL_UNSET_PROPERTY(isPlayStateSet, playState, setPlayState); - FILL_UNSET_PROPERTY(isNameSet, name, setName); - FILL_UNSET_PROPERTY(isTimingFunctionSet, timingFunction, setTimingFunction); - FILL_UNSET_PROPERTY(isPropertySet, property, setProperty); -} - -bool CSSAnimationDataList::operator==(const CSSAnimationDataList& o) const -{ - if (size() != o.size()) - return false; - for (size_t i = 0; i < size(); ++i) - if (*animation(i) != *o.animation(i)) - return false; - return true; -} - -} // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/platform/animation/CSSAnimationDataList.h b/chromium/third_party/WebKit/Source/core/platform/animation/CSSAnimationDataList.h deleted file mode 100644 index 48d855674f0..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/animation/CSSAnimationDataList.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2000 Lars Knoll (knoll@kde.org) - * (C) 2000 Antti Koivisto (koivisto@kde.org) - * (C) 2000 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. - * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#ifndef CSSAnimationDataList_h -#define CSSAnimationDataList_h - -#include "core/platform/animation/CSSAnimationData.h" -#include "wtf/RefPtr.h" -#include "wtf/Vector.h" - -namespace WebCore { - -class CSSAnimationDataList { - WTF_MAKE_FAST_ALLOCATED; -public: - CSSAnimationDataList() { } - explicit CSSAnimationDataList(const CSSAnimationDataList&); - - void fillUnsetProperties(); - bool operator==(const CSSAnimationDataList& o) const; - bool operator!=(const CSSAnimationDataList& o) const - { - return !(*this == o); - } - - size_t size() const { return m_animations.size(); } - bool isEmpty() const { return m_animations.isEmpty(); } - - void resize(size_t n) { m_animations.resize(n); } - void remove(size_t i) { m_animations.remove(i); } - void append(PassRefPtr<CSSAnimationData> anim) { m_animations.append(anim); } - - CSSAnimationData* animation(size_t i) { return m_animations[i].get(); } - const CSSAnimationData* animation(size_t i) const { return m_animations[i].get(); } - -private: - CSSAnimationDataList& operator=(const CSSAnimationDataList&); - - Vector<RefPtr<CSSAnimationData> > m_animations; -}; - - -} // namespace WebCore - -#endif // CSSAnimationDataList_h diff --git a/chromium/third_party/WebKit/Source/core/platform/animation/KeyframeValueList.cpp b/chromium/third_party/WebKit/Source/core/platform/animation/KeyframeValueList.cpp deleted file mode 100644 index 174172ccd5e..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/animation/KeyframeValueList.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * Copyright (C) 2013 Intel Corporation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#include "core/platform/animation/KeyframeValueList.h" - -namespace WebCore { - -void KeyframeValueList::insert(PassOwnPtr<const AnimationValue> value) -{ - for (size_t i = 0; i < m_values.size(); ++i) { - const AnimationValue* curValue = m_values[i].get(); - if (curValue->keyTime() == value->keyTime()) { - ASSERT_NOT_REACHED(); - // insert after - m_values.insert(i + 1, value); - return; - } - if (curValue->keyTime() > value->keyTime()) { - // insert before - m_values.insert(i, value); - return; - } - } - - m_values.append(value); -} - -} // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/platform/animation/KeyframeValueList.h b/chromium/third_party/WebKit/Source/core/platform/animation/KeyframeValueList.h deleted file mode 100644 index 86ffb0052f7..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/animation/KeyframeValueList.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * Copyright (C) 2013 Intel Corporation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef KeyframeValueList_h -#define KeyframeValueList_h - -#include "core/platform/animation/AnimationValue.h" - -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" -#include "wtf/Vector.h" - -namespace WebCore { - -enum AnimatedPropertyID { - AnimatedPropertyInvalid, - AnimatedPropertyWebkitTransform, - AnimatedPropertyOpacity, - AnimatedPropertyBackgroundColor, - AnimatedPropertyWebkitFilter -}; - -// Used to store a series of values in a keyframe list. -// Values will all be of the same type, which can be inferred from the property. -class KeyframeValueList { -public: - explicit KeyframeValueList(AnimatedPropertyID property) - : m_property(property) - { - } - - KeyframeValueList(const KeyframeValueList& other) - : m_property(other.property()) - { - for (size_t i = 0; i < other.m_values.size(); ++i) - m_values.append(other.m_values[i]->clone()); - } - - KeyframeValueList& operator=(const KeyframeValueList& other) - { - KeyframeValueList copy(other); - swap(copy); - return *this; - } - - void swap(KeyframeValueList& other) - { - std::swap(m_property, other.m_property); - m_values.swap(other.m_values); - } - - AnimatedPropertyID property() const { return m_property; } - - size_t size() const { return m_values.size(); } - const AnimationValue* at(size_t i) const { return m_values.at(i).get(); } - - // Insert, sorted by keyTime. - void insert(PassOwnPtr<const AnimationValue>); - -protected: - Vector<OwnPtr<const AnimationValue> > m_values; - AnimatedPropertyID m_property; -}; - -} // namespace WebCore - -#endif // KeyframeValueList_h diff --git a/chromium/third_party/WebKit/Source/core/platform/animation/TimingFunction.h b/chromium/third_party/WebKit/Source/core/platform/animation/TimingFunction.h deleted file mode 100644 index 147d86b390b..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/animation/TimingFunction.h +++ /dev/null @@ -1,330 +0,0 @@ -/* - * Copyright (C) 2000 Lars Knoll (knoll@kde.org) - * (C) 2000 Antti Koivisto (koivisto@kde.org) - * (C) 2000 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. - * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#ifndef TimingFunction_h -#define TimingFunction_h - -#include "RuntimeEnabledFeatures.h" -#include "platform/animation/AnimationUtilities.h" // For blend() -#include "platform/animation/UnitBezier.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" -#include "wtf/PassRefPtr.h" -#include "wtf/RefCounted.h" -#include "wtf/StdLibExtras.h" -#include "wtf/Vector.h" -#include <algorithm> - - -namespace WebCore { - -class TimingFunction : public RefCounted<TimingFunction> { -public: - - enum Type { - LinearFunction, CubicBezierFunction, StepsFunction, ChainedFunction - }; - - virtual ~TimingFunction() { } - - Type type() const { return m_type; } - - // Evaluates the timing function at the given fraction. The accuracy parameter provides a hint as to the required - // accuracy and is not guaranteed. - virtual double evaluate(double fraction, double accuracy) const = 0; - -protected: - TimingFunction(Type type) - : m_type(type) - { - } - -private: - Type m_type; -}; - -class LinearTimingFunction : public TimingFunction { -public: - static PassRefPtr<LinearTimingFunction> create() - { - return adoptRef(new LinearTimingFunction); - } - - ~LinearTimingFunction() { } - - virtual double evaluate(double fraction, double) const - { - ASSERT(RuntimeEnabledFeatures::webAnimationsCSSEnabled() || (fraction >= 0 && fraction <= 1)); - ASSERT_WITH_MESSAGE(!RuntimeEnabledFeatures::webAnimationsCSSEnabled() || (fraction >= 0 && fraction <= 1), "Web Animations not yet implemented: Timing function behavior outside the range [0, 1] is not yet specified"); - return fraction; - } - -private: - LinearTimingFunction() - : TimingFunction(LinearFunction) - { - } -}; - - -// Forward declare so we can friend it below. Don't use in production code! -class ChainedTimingFunctionTestHelper; - -class CubicBezierTimingFunction : public TimingFunction { -public: - enum SubType { - Ease, - EaseIn, - EaseOut, - EaseInOut, - Custom - }; - - static PassRefPtr<CubicBezierTimingFunction> create(double x1, double y1, double x2, double y2) - { - return adoptRef(new CubicBezierTimingFunction(Custom, x1, y1, x2, y2)); - } - - static CubicBezierTimingFunction* preset(SubType subType) - { - switch (subType) { - case Ease: - { - DEFINE_STATIC_REF(CubicBezierTimingFunction, ease, (adoptRef(new CubicBezierTimingFunction(Ease, 0.25, 0.1, 0.25, 1.0)))); - return ease; - } - case EaseIn: - { - DEFINE_STATIC_REF(CubicBezierTimingFunction, easeIn, (adoptRef(new CubicBezierTimingFunction(EaseIn, 0.42, 0.0, 1.0, 1.0)))); - return easeIn; - } - case EaseOut: - { - DEFINE_STATIC_REF(CubicBezierTimingFunction, easeOut, (adoptRef(new CubicBezierTimingFunction(EaseOut, 0.0, 0.0, 0.58, 1.0)))); - return easeOut; - } - case EaseInOut: - { - DEFINE_STATIC_REF(CubicBezierTimingFunction, easeInOut, (adoptRef(new CubicBezierTimingFunction(EaseInOut, 0.42, 0.0, 0.58, 1.0)))); - return easeInOut; - } - default: - ASSERT_NOT_REACHED(); - return 0; - } - } - - ~CubicBezierTimingFunction() { } - - virtual double evaluate(double fraction, double accuracy) const - { - ASSERT(RuntimeEnabledFeatures::webAnimationsCSSEnabled() || (fraction >= 0 && fraction <= 1)); - ASSERT_WITH_MESSAGE(!RuntimeEnabledFeatures::webAnimationsCSSEnabled() || (fraction >= 0 && fraction <= 1), "Web Animations not yet implemented: Timing function behavior outside the range [0, 1] is not yet specified"); - if (!m_bezier) - m_bezier = adoptPtr(new UnitBezier(m_x1, m_y1, m_x2, m_y2)); - return m_bezier->solve(fraction, accuracy); - } - - double x1() const { return m_x1; } - double y1() const { return m_y1; } - double x2() const { return m_x2; } - double y2() const { return m_y2; } - - SubType subType() const { return m_subType; } - -private: - explicit CubicBezierTimingFunction(SubType subType, double x1, double y1, double x2, double y2) - : TimingFunction(CubicBezierFunction) - , m_x1(x1) - , m_y1(y1) - , m_x2(x2) - , m_y2(y2) - , m_subType(subType) - { - } - - double m_x1; - double m_y1; - double m_x2; - double m_y2; - SubType m_subType; - mutable OwnPtr<UnitBezier> m_bezier; -}; - -class StepsTimingFunction : public TimingFunction { -public: - enum SubType { - Start, - End, - Custom - }; - - static PassRefPtr<StepsTimingFunction> create(int steps, bool stepAtStart) - { - return adoptRef(new StepsTimingFunction(Custom, steps, stepAtStart)); - } - - static StepsTimingFunction* preset(SubType subType) - { - switch (subType) { - case Start: - { - DEFINE_STATIC_REF(StepsTimingFunction, start, (adoptRef(new StepsTimingFunction(Start, 1, true)))); - return start; - } - case End: - { - DEFINE_STATIC_REF(StepsTimingFunction, end, (adoptRef(new StepsTimingFunction(End, 1, false)))); - return end; - } - default: - ASSERT_NOT_REACHED(); - return 0; - } - } - - - ~StepsTimingFunction() { } - - virtual double evaluate(double fraction, double) const - { - ASSERT(RuntimeEnabledFeatures::webAnimationsCSSEnabled() || (fraction >= 0 && fraction <= 1)); - ASSERT_WITH_MESSAGE(!RuntimeEnabledFeatures::webAnimationsCSSEnabled() || (fraction >= 0 && fraction <= 1), "Web Animations not yet implemented: Timing function behavior outside the range [0, 1] is not yet specified"); - return std::min(1.0, (floor(m_steps * fraction) + m_stepAtStart) / m_steps); - } - - int numberOfSteps() const { return m_steps; } - bool stepAtStart() const { return m_stepAtStart; } - - SubType subType() const { return m_subType; } - -private: - StepsTimingFunction(SubType subType, int steps, bool stepAtStart) - : TimingFunction(StepsFunction) - , m_steps(steps) - , m_stepAtStart(stepAtStart) - , m_subType(subType) - { - } - - int m_steps; - bool m_stepAtStart; - SubType m_subType; -}; - -class ChainedTimingFunction : public TimingFunction { -public: - static PassRefPtr<ChainedTimingFunction> create() - { - return adoptRef(new ChainedTimingFunction); - } - - void appendSegment(double upperBound, TimingFunction* timingFunction) - { - double max = m_segments.isEmpty() ? 0 : m_segments.last().max(); - ASSERT(upperBound > max); - m_segments.append(Segment(max, upperBound, timingFunction)); - } - virtual double evaluate(double fraction, double accuracy) const - { - ASSERT_WITH_MESSAGE(fraction >= 0 && fraction <= 1, "Web Animations not yet implemented: Timing function behavior outside the range [0, 1] is not yet specified"); - ASSERT(!m_segments.isEmpty()); - ASSERT(m_segments.last().max() == 1); - size_t i = 0; - const Segment* segment = &m_segments[i++]; - while (fraction >= segment->max() && i < m_segments.size()) { - segment = &m_segments[i++]; - } - return segment->evaluate(fraction, accuracy); - } - -private: - class Segment { - public: - Segment(double min, double max, TimingFunction* timingFunction) - : m_min(min) - , m_max(max) - , m_timingFunction(timingFunction) - { ASSERT(timingFunction); } - - double max() const { return m_max; } - double evaluate(double fraction, double accuracy) const - { - return scaleFromLocal(m_timingFunction->evaluate(scaleToLocal(fraction), accuracy)); - } - - private: - double scaleToLocal(double x) const { return (x - m_min) / (m_max - m_min); } - double scaleFromLocal(double x) const { return blend(m_min, m_max, x); } - - double m_min; - double m_max; - RefPtr<TimingFunction> m_timingFunction; - - // FIXME: Come up with a public API for the segments and remove this. - friend class CompositorAnimationsImpl; - friend class CompositorAnimations; - - // Allow the compositor to reverse the timing function. - friend class CompositorAnimationsTimingFunctionReverser; - - // Allow PrintTo/operator== of the segments. Can be removed once - // ChainedTimingFunction has a public API for segments. - friend class ChainedTimingFunctionTestHelper; - }; - - ChainedTimingFunction() - : TimingFunction(ChainedFunction) - { - ASSERT(RuntimeEnabledFeatures::webAnimationsCSSEnabled()); - } - - Vector<Segment> m_segments; - - // FIXME: Come up with a public API for the segments and remove this. - friend class CompositorAnimationsImpl; - friend class CompositorAnimations; - - // Allow the compositor to reverse the timing function. - friend class CompositorAnimationsTimingFunctionReverser; - - // Allow PrintTo/operator== of the segments. Can be removed once - // ChainedTimingFunction has a public API for segments. - friend class ChainedTimingFunctionTestHelper; -}; - -#define DEFINE_TIMING_FUNCTION_TYPE_CASTS(typeName) \ - DEFINE_TYPE_CASTS( \ - typeName##TimingFunction, TimingFunction, value, \ - value->type() == TimingFunction::typeName##Function, \ - value.type() == TimingFunction::typeName##Function) - -DEFINE_TIMING_FUNCTION_TYPE_CASTS(Linear); -DEFINE_TIMING_FUNCTION_TYPE_CASTS(CubicBezier); -DEFINE_TIMING_FUNCTION_TYPE_CASTS(Steps); -DEFINE_TIMING_FUNCTION_TYPE_CASTS(Chained); - -} // namespace WebCore - -#endif // TimingFunction_h diff --git a/chromium/third_party/WebKit/Source/core/platform/animation/TimingFunctionTestHelper.cpp b/chromium/third_party/WebKit/Source/core/platform/animation/TimingFunctionTestHelper.cpp deleted file mode 100644 index f1eeb962374..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/animation/TimingFunctionTestHelper.cpp +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Copyright (c) 2013, Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "core/platform/animation/TimingFunctionTestHelper.h" - - -namespace WebCore { - -// This class exists so that ChainedTimingFunction only needs to friend one thing. -class ChainedTimingFunctionTestHelper { - static void PrintTo(const ChainedTimingFunction& timingFunction, ::std::ostream* os) - { - // Forward declare the generic PrintTo function as ChainedTimingFunction needs to call it. - void PrintTo(const TimingFunction&, ::std::ostream*); - - *os << "ChainedTimingFunction@" << &timingFunction << "("; - for (size_t i = 0; i < timingFunction.m_segments.size(); i++) { - ChainedTimingFunction::Segment segment = timingFunction.m_segments[i]; - PrintTo(*(segment.m_timingFunction.get()), os); - *os << "[" << segment.m_min << " -> " << segment.m_max << "]"; - if (i+1 != timingFunction.m_segments.size()) { - *os << ", "; - } - } - *os << ")"; - } - - static bool equals(const ChainedTimingFunction& lhs, const TimingFunction& rhs) - { - if (rhs.type() != TimingFunction::ChainedFunction) - return false; - - if (&lhs == &rhs) - return true; - - const ChainedTimingFunction& ctf = toChainedTimingFunction(rhs); - if (lhs.m_segments.size() != ctf.m_segments.size()) - return false; - - for (size_t i = 0; i < lhs.m_segments.size(); i++) { - if (!equals(lhs.m_segments[i], ctf.m_segments[i])) - return false; - } - return true; - } - - static bool equals(const ChainedTimingFunction::Segment& lhs, const ChainedTimingFunction::Segment& rhs) - { - if (&lhs == &rhs) - return true; - - if ((lhs.m_min != rhs.m_min) || (lhs.m_max != rhs.m_max)) - return false; - - if (lhs.m_timingFunction == rhs.m_timingFunction) - return true; - - ASSERT(lhs.m_timingFunction); - ASSERT(rhs.m_timingFunction); - - return (*(lhs.m_timingFunction.get())) == (*(rhs.m_timingFunction.get())); - } - - friend void PrintTo(const ChainedTimingFunction&, ::std::ostream*); - friend bool operator==(const ChainedTimingFunction& lhs, const TimingFunction& rhs); -}; - -void PrintTo(const LinearTimingFunction& timingFunction, ::std::ostream* os) -{ - *os << "LinearTimingFunction@" << &timingFunction; -} - -void PrintTo(const CubicBezierTimingFunction& timingFunction, ::std::ostream* os) -{ - *os << "CubicBezierTimingFunction@" << &timingFunction << "("; - switch (timingFunction.subType()) { - case CubicBezierTimingFunction::Ease: - *os << "Ease"; - break; - case CubicBezierTimingFunction::EaseIn: - *os << "EaseIn"; - break; - case CubicBezierTimingFunction::EaseOut: - *os << "EaseOut"; - break; - case CubicBezierTimingFunction::EaseInOut: - *os << "EaseInOut"; - break; - case CubicBezierTimingFunction::Custom: - *os << "Custom"; - break; - default: - ASSERT_NOT_REACHED(); - } - *os << ", " << timingFunction.x1(); - *os << ", " << timingFunction.y1(); - *os << ", " << timingFunction.x2(); - *os << ", " << timingFunction.y2(); - *os << ")"; -} - -void PrintTo(const StepsTimingFunction& timingFunction, ::std::ostream* os) -{ - *os << "StepsTimingFunction@" << &timingFunction << "("; - switch (timingFunction.subType()) { - case StepsTimingFunction::Start: - *os << "Start"; - break; - case StepsTimingFunction::End: - *os << "End"; - break; - case StepsTimingFunction::Custom: - *os << "Custom"; - break; - default: - ASSERT_NOT_REACHED(); - } - *os << ", " << timingFunction.numberOfSteps(); - *os << ", " << (timingFunction.stepAtStart() ? "true" : "false"); - *os << ")"; -} - -void PrintTo(const ChainedTimingFunction& timingFunction, ::std::ostream* os) -{ - ChainedTimingFunctionTestHelper::PrintTo(timingFunction, os); -} - -// The generic PrintTo *must* come after the non-generic PrintTo otherwise it -// will end up calling itself. -void PrintTo(const TimingFunction& timingFunction, ::std::ostream* os) -{ - switch (timingFunction.type()) { - case TimingFunction::LinearFunction: { - const LinearTimingFunction& linear = toLinearTimingFunction(timingFunction); - PrintTo(linear, os); - return; - } - case TimingFunction::CubicBezierFunction: { - const CubicBezierTimingFunction& cubic = toCubicBezierTimingFunction(timingFunction); - PrintTo(cubic, os); - return; - } - case TimingFunction::StepsFunction: { - const StepsTimingFunction& step = toStepsTimingFunction(timingFunction); - PrintTo(step, os); - return; - } - case TimingFunction::ChainedFunction: { - const ChainedTimingFunction& chained = toChainedTimingFunction(timingFunction); - PrintTo(chained, os); - return; - } - default: - ASSERT_NOT_REACHED(); - } -} - -bool operator==(const LinearTimingFunction& lhs, const TimingFunction& rhs) -{ - return rhs.type() == TimingFunction::LinearFunction; -} - -bool operator==(const CubicBezierTimingFunction& lhs, const TimingFunction& rhs) -{ - if (rhs.type() != TimingFunction::CubicBezierFunction) - return false; - - const CubicBezierTimingFunction& ctf = toCubicBezierTimingFunction(rhs); - if ((lhs.subType() == CubicBezierTimingFunction::Custom) && (ctf.subType() == CubicBezierTimingFunction::Custom)) - return (lhs.x1() == ctf.x1()) && (lhs.y1() == ctf.y1()) && (lhs.x2() == ctf.x2()) && (lhs.y2() == ctf.y2()); - - return lhs.subType() == ctf.subType(); -} - -bool operator==(const StepsTimingFunction& lhs, const TimingFunction& rhs) -{ - if (rhs.type() != TimingFunction::StepsFunction) - return false; - - const StepsTimingFunction& stf = toStepsTimingFunction(rhs); - if ((lhs.subType() == StepsTimingFunction::Custom) && (stf.subType() == StepsTimingFunction::Custom)) - return (lhs.numberOfSteps() == stf.numberOfSteps()) && (lhs.stepAtStart() == stf.stepAtStart()); - - return lhs.subType() == stf.subType(); -} - -bool operator==(const ChainedTimingFunction& lhs, const TimingFunction& rhs) -{ - return ChainedTimingFunctionTestHelper::equals(lhs, rhs); -} - -// Like in the PrintTo case, the generic operator== *must* come after the -// non-generic operator== otherwise it will end up calling itself. -bool operator==(const TimingFunction& lhs, const TimingFunction& rhs) -{ - switch (lhs.type()) { - case TimingFunction::LinearFunction: { - const LinearTimingFunction& linear = toLinearTimingFunction(lhs); - return (linear == rhs); - } - case TimingFunction::CubicBezierFunction: { - const CubicBezierTimingFunction& cubic = toCubicBezierTimingFunction(lhs); - return (cubic == rhs); - } - case TimingFunction::StepsFunction: { - const StepsTimingFunction& step = toStepsTimingFunction(lhs); - return (step == rhs); - } - case TimingFunction::ChainedFunction: { - const ChainedTimingFunction& chained = toChainedTimingFunction(lhs); - return (chained == rhs); - } - default: - ASSERT_NOT_REACHED(); - } - return false; -} - -// No need to define specific operator!= as they can all come via this function. -bool operator!=(const TimingFunction& lhs, const TimingFunction& rhs) -{ - return !(lhs == rhs); -} - -} // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/platform/animation/TimingFunctionTestHelper.h b/chromium/third_party/WebKit/Source/core/platform/animation/TimingFunctionTestHelper.h deleted file mode 100644 index 06eaf0604f6..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/animation/TimingFunctionTestHelper.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2013, Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * Make testing with gtest and gmock nicer by adding pretty print and other - * helper functions. - */ - -#ifndef TimingFunctionTestHelper_h -#define TimingFunctionTestHelper_h - -#include "core/platform/animation/TimingFunction.h" - -#include <ostream> // NOLINT - -namespace WebCore { - -// PrintTo functions -void PrintTo(const LinearTimingFunction&, ::std::ostream*); -void PrintTo(const CubicBezierTimingFunction&, ::std::ostream*); -void PrintTo(const StepsTimingFunction&, ::std::ostream*); -void PrintTo(const ChainedTimingFunction&, ::std::ostream*); -void PrintTo(const TimingFunction&, ::std::ostream*); - -// operator== functions -bool operator==(const LinearTimingFunction&, const TimingFunction&); -bool operator==(const CubicBezierTimingFunction&, const TimingFunction&); -bool operator==(const StepsTimingFunction&, const TimingFunction&); -bool operator==(const ChainedTimingFunction&, const TimingFunction&); - -bool operator==(const TimingFunction&, const TimingFunction&); -bool operator!=(const TimingFunction&, const TimingFunction&); - -} // namespace WebCore - -#endif diff --git a/chromium/third_party/WebKit/Source/core/platform/animation/TimingFunctionTestHelperTest.cpp b/chromium/third_party/WebKit/Source/core/platform/animation/TimingFunctionTestHelperTest.cpp deleted file mode 100644 index 01059a6c3ac..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/animation/TimingFunctionTestHelperTest.cpp +++ /dev/null @@ -1,326 +0,0 @@ -/* - * Copyright (c) 2013, Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#include "core/platform/animation/TimingFunctionTestHelper.h" - -#include <gmock/gmock.h> -#include <gtest/gtest.h> -#include <sstream> -#include <string> - -// FIXME: Remove once https://codereview.chromium.org/50603011/ lands. -#define EXPECT_REFV_EQ(a, b) EXPECT_EQ(*(a.get()), *(b.get())) -#define EXPECT_REFV_NE(a, b) EXPECT_NE(*(a.get()), *(b.get())) - -// Couple of macros to quickly assert a bunch of timing functions are not -// equal. -#define NE_STRINGIZE(x) NE_STRINGIZE2(x) -#define NE_STRINGIZE2(x) #x -#define NE_HELPER(v) \ - Vector<std::pair<std::string, RefPtr<TimingFunction> > > v; -#define NE_HELPER_APPEND(v, x) \ - v.append(std::make_pair(std::string("Line " NE_STRINGIZE(__LINE__) ":" # x), x)) -#define NE_HELPER_LOOP(v) \ - for (size_t i = 0; i != v.size(); ++i) { \ - for (size_t j = 0; j != v.size(); ++j) { \ - if (i == j) \ - continue; \ - EXPECT_REFV_NE(v[i].second, v[j].second) \ - << v[i].first \ - << " (" << ::testing::PrintToString(*v[i].second.get()) << ")" \ - << " == " \ - << v[j].first \ - << " (" << ::testing::PrintToString(*v[j].second.get()) << ")" \ - << "\n"; \ - } \ - } - -namespace { - -using namespace WebCore; - -class TimingFunctionTestHelperTest : public ::testing::Test { - -public: - // Make sure that the CubicBezierTimingFunction call goes via the generic - // TimingFunction PrintTo. - ::std::string PrintToString(RefPtr<CubicBezierTimingFunction> timing) - { - RefPtr<TimingFunction> generic = timing; - return PrintToString(generic.get()); - } - - ::std::string PrintToString(RefPtr<TimingFunction> timing) - { - return PrintToString(timing.get()); - } - - ::std::string PrintToString(const TimingFunction* timing) - { - return ::testing::PrintToString(*timing); - } -}; - -TEST_F(TimingFunctionTestHelperTest, LinearPrintTo) -{ - RefPtr<TimingFunction> linearTiming = LinearTimingFunction::create(); - EXPECT_THAT( - PrintToString(linearTiming), - ::testing::MatchesRegex("LinearTimingFunction@.*")); -} - -TEST_F(TimingFunctionTestHelperTest, CubicPrintTo) -{ - RefPtr<TimingFunction> cubicEaseTiming = CubicBezierTimingFunction::preset(CubicBezierTimingFunction::EaseIn); - EXPECT_THAT( - PrintToString(cubicEaseTiming), - ::testing::MatchesRegex("CubicBezierTimingFunction@.*\\(EaseIn, 0.42, 0, 1, 1\\)")); - - RefPtr<TimingFunction> cubicCustomTiming = CubicBezierTimingFunction::create(0.17, 0.67, 1, -1.73); - EXPECT_THAT( - PrintToString(cubicCustomTiming), - ::testing::MatchesRegex("CubicBezierTimingFunction@.*\\(Custom, 0.17, 0.67, 1, -1.73\\)")); -} - -TEST_F(TimingFunctionTestHelperTest, StepPrintTo) -{ - RefPtr<TimingFunction> stepTimingStart = StepsTimingFunction::preset(StepsTimingFunction::Start); - EXPECT_THAT( - PrintToString(stepTimingStart), - ::testing::MatchesRegex("StepsTimingFunction@.*\\(Start, 1, true\\)")); - - RefPtr<TimingFunction> stepTimingCustom = StepsTimingFunction::create(5, false); - EXPECT_THAT( - PrintToString(stepTimingCustom), - ::testing::MatchesRegex("StepsTimingFunction@.*\\(Custom, 5, false\\)")); -} - -TEST_F(TimingFunctionTestHelperTest, ChainedPrintTo) -{ - RefPtr<TimingFunction> linearTiming = LinearTimingFunction::create(); - RefPtr<ChainedTimingFunction> chainedLinearSingle = ChainedTimingFunction::create(); - chainedLinearSingle->appendSegment(1.0, linearTiming.get()); - EXPECT_THAT( - PrintToString(chainedLinearSingle), - ::testing::MatchesRegex( - "ChainedTimingFunction@.*\\(" - "LinearTimingFunction@.*\\[0 -> 1\\]" - "\\)")); - - RefPtr<TimingFunction> cubicCustomTiming = CubicBezierTimingFunction::create(1.0, 0.0, 1, -1); - - RefPtr<ChainedTimingFunction> chainedMixed = ChainedTimingFunction::create(); - chainedMixed->appendSegment(0.75, chainedLinearSingle.get()); - chainedMixed->appendSegment(1.0, cubicCustomTiming.get()); - EXPECT_THAT( - PrintToString(chainedMixed), - ::testing::MatchesRegex( - "ChainedTimingFunction@.*\\(" - "ChainedTimingFunction@.*\\(" - "LinearTimingFunction@.*\\[0 -> 1\\]" - "\\)\\[0 -> 0.75\\], " - "CubicBezierTimingFunction@.*\\(Custom, 1, 0, 1, -1\\)\\[0.75 -> 1\\]" - "\\)")); -} - -TEST_F(TimingFunctionTestHelperTest, BaseOperatorEq) -{ - RefPtr<TimingFunction> linearTiming = LinearTimingFunction::create(); - RefPtr<TimingFunction> cubicTiming1 = CubicBezierTimingFunction::preset(CubicBezierTimingFunction::EaseIn); - RefPtr<TimingFunction> cubicTiming2 = CubicBezierTimingFunction::create(0.17, 0.67, 1, -1.73); - RefPtr<TimingFunction> stepsTiming1 = StepsTimingFunction::preset(StepsTimingFunction::End); - RefPtr<TimingFunction> stepsTiming2 = StepsTimingFunction::create(5, true); - - RefPtr<ChainedTimingFunction> chainedTiming1 = ChainedTimingFunction::create(); - chainedTiming1->appendSegment(1.0, linearTiming.get()); - - RefPtr<ChainedTimingFunction> chainedTiming2 = ChainedTimingFunction::create(); - chainedTiming2->appendSegment(0.5, cubicTiming1.get()); - chainedTiming2->appendSegment(1.0, cubicTiming2.get()); - - NE_HELPER(v); - NE_HELPER_APPEND(v, linearTiming); - NE_HELPER_APPEND(v, cubicTiming1); - NE_HELPER_APPEND(v, cubicTiming2); - NE_HELPER_APPEND(v, stepsTiming1); - NE_HELPER_APPEND(v, stepsTiming2); - NE_HELPER_APPEND(v, chainedTiming1); - NE_HELPER_APPEND(v, chainedTiming2); - NE_HELPER_LOOP(v); -} - -TEST_F(TimingFunctionTestHelperTest, LinearOperatorEq) -{ - RefPtr<TimingFunction> linearTiming1 = LinearTimingFunction::create(); - RefPtr<TimingFunction> linearTiming2 = LinearTimingFunction::create(); - EXPECT_REFV_EQ(linearTiming1, linearTiming1); - EXPECT_REFV_EQ(linearTiming1, linearTiming2); -} - -TEST_F(TimingFunctionTestHelperTest, CubicOperatorEq) -{ - RefPtr<TimingFunction> cubicEaseInTiming1 = CubicBezierTimingFunction::preset(CubicBezierTimingFunction::EaseIn); - RefPtr<TimingFunction> cubicEaseInTiming2 = CubicBezierTimingFunction::preset(CubicBezierTimingFunction::EaseIn); - EXPECT_REFV_EQ(cubicEaseInTiming1, cubicEaseInTiming1); - EXPECT_REFV_EQ(cubicEaseInTiming1, cubicEaseInTiming2); - - RefPtr<TimingFunction> cubicEaseOutTiming1 = CubicBezierTimingFunction::preset(CubicBezierTimingFunction::EaseOut); - RefPtr<TimingFunction> cubicEaseOutTiming2 = CubicBezierTimingFunction::preset(CubicBezierTimingFunction::EaseOut); - EXPECT_REFV_EQ(cubicEaseOutTiming1, cubicEaseOutTiming2); - - RefPtr<TimingFunction> cubicEaseInOutTiming1 = CubicBezierTimingFunction::preset(CubicBezierTimingFunction::EaseInOut); - RefPtr<TimingFunction> cubicEaseInOutTiming2 = CubicBezierTimingFunction::preset(CubicBezierTimingFunction::EaseInOut); - EXPECT_REFV_EQ(cubicEaseInOutTiming1, cubicEaseInOutTiming2); - - RefPtr<TimingFunction> cubicCustomTiming1 = CubicBezierTimingFunction::create(0.17, 0.67, 1, -1.73); - RefPtr<TimingFunction> cubicCustomTiming2 = CubicBezierTimingFunction::create(0.17, 0.67, 1, -1.73); - EXPECT_REFV_EQ(cubicCustomTiming1, cubicCustomTiming2); - - NE_HELPER(v); - NE_HELPER_APPEND(v, cubicEaseInTiming1); - NE_HELPER_APPEND(v, cubicEaseOutTiming1); - NE_HELPER_APPEND(v, cubicEaseInOutTiming1); - NE_HELPER_APPEND(v, cubicCustomTiming1); - NE_HELPER_LOOP(v); -} - -TEST_F(TimingFunctionTestHelperTest, CubicOperatorEqReflectivity) -{ - RefPtr<TimingFunction> cubicA = CubicBezierTimingFunction::preset(CubicBezierTimingFunction::EaseIn); - RefPtr<TimingFunction> cubicB = CubicBezierTimingFunction::create(0.42, 0.0, 1.0, 1.0); - EXPECT_REFV_NE(cubicA, cubicB); - EXPECT_REFV_NE(cubicB, cubicA); -} - -TEST_F(TimingFunctionTestHelperTest, StepsOperatorEq) -{ - RefPtr<TimingFunction> stepsTimingStart1 = StepsTimingFunction::preset(StepsTimingFunction::Start); - RefPtr<TimingFunction> stepsTimingStart2 = StepsTimingFunction::preset(StepsTimingFunction::Start); - EXPECT_REFV_EQ(stepsTimingStart1, stepsTimingStart1); - EXPECT_REFV_EQ(stepsTimingStart1, stepsTimingStart2); - - RefPtr<TimingFunction> stepsTimingEnd1 = StepsTimingFunction::preset(StepsTimingFunction::End); - RefPtr<TimingFunction> stepsTimingEnd2 = StepsTimingFunction::preset(StepsTimingFunction::End); - EXPECT_REFV_EQ(stepsTimingEnd1, stepsTimingEnd2); - - RefPtr<TimingFunction> stepsTimingCustom1 = StepsTimingFunction::create(5, true); - RefPtr<TimingFunction> stepsTimingCustom2 = StepsTimingFunction::create(5, false); - RefPtr<TimingFunction> stepsTimingCustom3 = StepsTimingFunction::create(7, true); - RefPtr<TimingFunction> stepsTimingCustom4 = StepsTimingFunction::create(7, false); - - EXPECT_REFV_EQ(stepsTimingCustom1, StepsTimingFunction::create(5, true)); - EXPECT_REFV_EQ(stepsTimingCustom2, StepsTimingFunction::create(5, false)); - EXPECT_REFV_EQ(stepsTimingCustom3, StepsTimingFunction::create(7, true)); - EXPECT_REFV_EQ(stepsTimingCustom4, StepsTimingFunction::create(7, false)); - - NE_HELPER(v); - NE_HELPER_APPEND(v, stepsTimingStart1); - NE_HELPER_APPEND(v, stepsTimingEnd1); - NE_HELPER_APPEND(v, stepsTimingCustom1); - NE_HELPER_APPEND(v, stepsTimingCustom2); - NE_HELPER_APPEND(v, stepsTimingCustom3); - NE_HELPER_APPEND(v, stepsTimingCustom4); - NE_HELPER_LOOP(v); -} - -TEST_F(TimingFunctionTestHelperTest, StepsOperatorEqReflectivity) -{ - RefPtr<TimingFunction> stepsA = StepsTimingFunction::preset(StepsTimingFunction::Start); - RefPtr<TimingFunction> stepsB = StepsTimingFunction::create(1, true); - EXPECT_REFV_NE(stepsA, stepsB); - EXPECT_REFV_NE(stepsB, stepsA); -} - -TEST_F(TimingFunctionTestHelperTest, ChainedEq) -{ - // Single item in chain - RefPtr<TimingFunction> cubicTiming1 = CubicBezierTimingFunction::create(0.25, 0.1, 0.25, 1.0); - RefPtr<TimingFunction> cubicTiming2 = CubicBezierTimingFunction::create(0.25, 0.1, 0.25, 1.0); - RefPtr<TimingFunction> cubicTiming3 = CubicBezierTimingFunction::preset(CubicBezierTimingFunction::EaseOut); - - RefPtr<ChainedTimingFunction> chainedSingleCubic1 = ChainedTimingFunction::create(); - chainedSingleCubic1->appendSegment(1.0, cubicTiming1.get()); - EXPECT_REFV_EQ(chainedSingleCubic1, chainedSingleCubic1); - - RefPtr<ChainedTimingFunction> chainedSingleCubic2 = ChainedTimingFunction::create(); - chainedSingleCubic2->appendSegment(1.0, cubicTiming1.get()); // Same inner timing function - EXPECT_REFV_EQ(chainedSingleCubic1, chainedSingleCubic2); - - RefPtr<ChainedTimingFunction> chainedSingleCubic3 = ChainedTimingFunction::create(); - chainedSingleCubic3->appendSegment(1.0, cubicTiming2.get()); // == inner timing function - EXPECT_REFV_EQ(chainedSingleCubic1, chainedSingleCubic3); - - RefPtr<ChainedTimingFunction> chainedSingleCubic4 = ChainedTimingFunction::create(); - chainedSingleCubic4->appendSegment(0.5, cubicTiming1.get()); // Different offset - EXPECT_REFV_NE(chainedSingleCubic1, chainedSingleCubic4); - EXPECT_REFV_NE(chainedSingleCubic3, chainedSingleCubic4); - - RefPtr<ChainedTimingFunction> chainedSingleCubic5 = ChainedTimingFunction::create(); - chainedSingleCubic5->appendSegment(1.0, cubicTiming3.get()); // != inner timing function (same type) - EXPECT_REFV_NE(chainedSingleCubic1, chainedSingleCubic5); - EXPECT_REFV_NE(chainedSingleCubic2, chainedSingleCubic5); - EXPECT_REFV_NE(chainedSingleCubic3, chainedSingleCubic5); - EXPECT_REFV_NE(chainedSingleCubic4, chainedSingleCubic5); - - RefPtr<TimingFunction> linearTiming1 = LinearTimingFunction::create(); - RefPtr<ChainedTimingFunction> chainedSingleLinear1 = ChainedTimingFunction::create(); - chainedSingleLinear1->appendSegment(1.0, linearTiming1.get()); // != inner timing function (different type) - EXPECT_REFV_NE(chainedSingleLinear1, chainedSingleCubic1); - EXPECT_REFV_NE(chainedSingleLinear1, chainedSingleCubic2); - EXPECT_REFV_NE(chainedSingleLinear1, chainedSingleCubic3); - EXPECT_REFV_NE(chainedSingleLinear1, chainedSingleCubic4); - - // Multiple items in chain - RefPtr<ChainedTimingFunction> chainedMixed1 = ChainedTimingFunction::create(); - chainedMixed1->appendSegment(0.25, chainedSingleLinear1.get()); - chainedMixed1->appendSegment(1.0, cubicTiming1.get()); - - RefPtr<ChainedTimingFunction> chainedMixed2 = ChainedTimingFunction::create(); - chainedMixed2->appendSegment(0.25, chainedSingleLinear1.get()); - chainedMixed2->appendSegment(1.0, cubicTiming1.get()); - - RefPtr<ChainedTimingFunction> chainedMixed3 = ChainedTimingFunction::create(); - chainedMixed3->appendSegment(0.25, chainedSingleLinear1.get()); - chainedMixed3->appendSegment(1.0, cubicTiming2.get()); - - EXPECT_REFV_EQ(chainedMixed1, chainedMixed2); - EXPECT_REFV_EQ(chainedMixed1, chainedMixed3); - EXPECT_REFV_NE(chainedMixed1, chainedSingleCubic1); - EXPECT_REFV_NE(chainedMixed1, chainedSingleLinear1); - - RefPtr<ChainedTimingFunction> chainedMixed4 = ChainedTimingFunction::create(); - chainedMixed4->appendSegment(0.20, chainedSingleLinear1.get()); // Different offset - chainedMixed4->appendSegment(1.0, cubicTiming1.get()); - EXPECT_REFV_NE(chainedMixed1, chainedMixed4); -} - -} // namespace diff --git a/chromium/third_party/WebKit/Source/core/platform/chromium/ChromiumDataObject.cpp b/chromium/third_party/WebKit/Source/core/platform/chromium/ChromiumDataObject.cpp deleted file mode 100644 index afbf866911b..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/chromium/ChromiumDataObject.cpp +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Copyright (c) 2008, 2009, 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "core/platform/chromium/ChromiumDataObject.h" - -#include "core/platform/Pasteboard.h" -#include "platform/clipboard/ClipboardMimeTypes.h" -#include "platform/clipboard/ClipboardUtilities.h" -#include "public/platform/Platform.h" -#include "public/platform/WebClipboard.h" - -namespace WebCore { - -PassRefPtr<ChromiumDataObject> ChromiumDataObject::createFromPasteboard(PasteMode pasteMode) -{ - RefPtr<ChromiumDataObject> dataObject = create(); - blink::WebClipboard::Buffer buffer = Pasteboard::generalPasteboard()->buffer(); - uint64_t sequenceNumber = blink::Platform::current()->clipboard()->sequenceNumber(buffer); - bool ignored; - blink::WebVector<blink::WebString> webTypes = blink::Platform::current()->clipboard()->readAvailableTypes(buffer, &ignored); - ListHashSet<String> types; - for (size_t i = 0; i < webTypes.size(); ++i) - types.add(webTypes[i]); - for (ListHashSet<String>::const_iterator it = types.begin(); it != types.end(); ++it) { - if (pasteMode == PlainTextOnly && *it != mimeTypeTextPlain) - continue; - dataObject->m_itemList.append(ChromiumDataObjectItem::createFromPasteboard(*it, sequenceNumber)); - } - return dataObject.release(); -} - -PassRefPtr<ChromiumDataObject> ChromiumDataObject::create() -{ - return adoptRef(new ChromiumDataObject()); -} - -PassRefPtr<ChromiumDataObject> ChromiumDataObject::copy() const -{ - return adoptRef(new ChromiumDataObject(*this)); -} - -size_t ChromiumDataObject::length() const -{ - return m_itemList.size(); -} - -PassRefPtr<ChromiumDataObjectItem> ChromiumDataObject::item(unsigned long index) -{ - if (index >= length()) - return 0; - return m_itemList[index]; -} - -void ChromiumDataObject::deleteItem(unsigned long index) -{ - if (index >= length()) - return; - m_itemList.remove(index); -} - -void ChromiumDataObject::clearAll() -{ - m_itemList.clear(); -} - -PassRefPtr<ChromiumDataObjectItem> ChromiumDataObject::add(const String& data, const String& type) -{ - RefPtr<ChromiumDataObjectItem> item = ChromiumDataObjectItem::createFromString(type, data); - if (!internalAddStringItem(item)) - return 0; - return item; -} - -PassRefPtr<ChromiumDataObjectItem> ChromiumDataObject::add(PassRefPtr<File> file) -{ - if (!file) - return 0; - - RefPtr<ChromiumDataObjectItem> item = ChromiumDataObjectItem::createFromFile(file); - m_itemList.append(item); - return item; -} - -void ChromiumDataObject::clearData(const String& type) -{ - for (size_t i = 0; i < m_itemList.size(); ++i) { - if (m_itemList[i]->kind() == ChromiumDataObjectItem::StringKind && m_itemList[i]->type() == type) { - // Per the spec, type must be unique among all items of kind 'string'. - m_itemList.remove(i); - return; - } - } -} - -void ChromiumDataObject::clearAllExceptFiles() -{ - for (size_t i = 0; i < m_itemList.size(); ) { - if (m_itemList[i]->kind() != ChromiumDataObjectItem::FileKind) { - m_itemList.remove(i); - continue; - } - ++i; - } -} - -ListHashSet<String> ChromiumDataObject::types() const -{ - ListHashSet<String> results; - bool containsFiles = false; - for (size_t i = 0; i < m_itemList.size(); ++i) { - switch (m_itemList[i]->kind()) { - case ChromiumDataObjectItem::StringKind: - results.add(m_itemList[i]->type()); - break; - case ChromiumDataObjectItem::FileKind: - containsFiles = true; - break; - } - } - if (containsFiles) - results.add(mimeTypeFiles); - return results; -} - -String ChromiumDataObject::getData(const String& type) const -{ - for (size_t i = 0; i < m_itemList.size(); ++i) { - if (m_itemList[i]->kind() == ChromiumDataObjectItem::StringKind && m_itemList[i]->type() == type) - return m_itemList[i]->internalGetAsString(); - } - return String(); -} - -bool ChromiumDataObject::setData(const String& type, const String& data) -{ - clearData(type); - if (!add(data, type)) - ASSERT_NOT_REACHED(); - return true; -} - -void ChromiumDataObject::urlAndTitle(String& url, String* title) const -{ - RefPtr<ChromiumDataObjectItem> item = findStringItem(mimeTypeTextURIList); - if (!item) - return; - url = convertURIListToURL(item->internalGetAsString()); - if (title) - *title = item->title(); -} - -void ChromiumDataObject::setURLAndTitle(const String& url, const String& title) -{ - clearData(mimeTypeTextURIList); - internalAddStringItem(ChromiumDataObjectItem::createFromURL(url, title)); -} - -void ChromiumDataObject::htmlAndBaseURL(String& html, KURL& baseURL) const -{ - RefPtr<ChromiumDataObjectItem> item = findStringItem(mimeTypeTextHTML); - if (!item) - return; - html = item->internalGetAsString(); - baseURL = item->baseURL(); -} - -void ChromiumDataObject::setHTMLAndBaseURL(const String& html, const KURL& baseURL) -{ - clearData(mimeTypeTextHTML); - internalAddStringItem(ChromiumDataObjectItem::createFromHTML(html, baseURL)); -} - -bool ChromiumDataObject::containsFilenames() const -{ - for (size_t i = 0; i < m_itemList.size(); ++i) - if (m_itemList[i]->isFilename()) - return true; - return false; -} - -Vector<String> ChromiumDataObject::filenames() const -{ - Vector<String> results; - for (size_t i = 0; i < m_itemList.size(); ++i) - if (m_itemList[i]->isFilename()) - results.append(static_cast<File*>(m_itemList[i]->getAsFile().get())->path()); - return results; -} - -void ChromiumDataObject::addFilename(const String& filename, const String& displayName) -{ - internalAddFileItem(ChromiumDataObjectItem::createFromFile(File::createWithName(filename, displayName, File::AllContentTypes))); -} - -void ChromiumDataObject::addSharedBuffer(const String& name, PassRefPtr<SharedBuffer> buffer) -{ - internalAddFileItem(ChromiumDataObjectItem::createFromSharedBuffer(name, buffer)); -} - -ChromiumDataObject::ChromiumDataObject() - : m_modifierKeyState(0) -{ -} - -ChromiumDataObject::ChromiumDataObject(const ChromiumDataObject& other) - : RefCounted<ChromiumDataObject>() - , m_itemList(other.m_itemList) - , m_modifierKeyState(0) -{ -} - -PassRefPtr<ChromiumDataObjectItem> ChromiumDataObject::findStringItem(const String& type) const -{ - for (size_t i = 0; i < m_itemList.size(); ++i) { - if (m_itemList[i]->kind() == ChromiumDataObjectItem::StringKind && m_itemList[i]->type() == type) - return m_itemList[i]; - } - return 0; -} - -bool ChromiumDataObject::internalAddStringItem(PassRefPtr<ChromiumDataObjectItem> item) -{ - ASSERT(item->kind() == ChromiumDataObjectItem::StringKind); - for (size_t i = 0; i < m_itemList.size(); ++i) - if (m_itemList[i]->kind() == ChromiumDataObjectItem::StringKind && m_itemList[i]->type() == item->type()) - return false; - - m_itemList.append(item); - return true; -} - -void ChromiumDataObject::internalAddFileItem(PassRefPtr<ChromiumDataObjectItem> item) -{ - ASSERT(item->kind() == ChromiumDataObjectItem::FileKind); - m_itemList.append(item); -} - -} // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/platform/chromium/ChromiumDataObject.h b/chromium/third_party/WebKit/Source/core/platform/chromium/ChromiumDataObject.h deleted file mode 100644 index 506952d0581..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/chromium/ChromiumDataObject.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2008, 2009, Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef ChromiumDataObject_h -#define ChromiumDataObject_h - -#include "core/platform/chromium/ChromiumDataObjectItem.h" -#include "platform/PasteMode.h" -#include "platform/Supplementable.h" -#include "wtf/ListHashSet.h" -#include "wtf/RefCounted.h" -#include "wtf/RefPtr.h" -#include "wtf/text/StringHash.h" -#include "wtf/text/WTFString.h" -#include "wtf/Vector.h" - -namespace WebCore { - -class KURL; -class SharedBuffer; - -// A data object for holding data that would be in a clipboard or moved -// during a drag-n-drop operation. This is the data that WebCore is aware -// of and is not specific to a platform. -class ChromiumDataObject : public RefCounted<ChromiumDataObject>, public Supplementable<ChromiumDataObject> { -public: - static PassRefPtr<ChromiumDataObject> createFromPasteboard(PasteMode); - static PassRefPtr<ChromiumDataObject> create(); - - PassRefPtr<ChromiumDataObject> copy() const; - - // DataTransferItemList support. - size_t length() const; - PassRefPtr<ChromiumDataObjectItem> item(unsigned long index); - // FIXME: Implement V8DataTransferItemList::indexedPropertyDeleter to get this called. - void deleteItem(unsigned long index); - void clearAll(); - // Returns null if an item already exists with the provided type. - PassRefPtr<ChromiumDataObjectItem> add(const String& data, const String& type); - PassRefPtr<ChromiumDataObjectItem> add(PassRefPtr<File>); - - // WebCore helpers. - void clearData(const String& type); - void clearAllExceptFiles(); - - ListHashSet<String> types() const; - String getData(const String& type) const; - bool setData(const String& type, const String& data); - - void urlAndTitle(String& url, String* title = 0) const; - void setURLAndTitle(const String& url, const String& title); - void htmlAndBaseURL(String& html, KURL& baseURL) const; - void setHTMLAndBaseURL(const String& html, const KURL& baseURL); - - // Used for dragging in files from the desktop. - bool containsFilenames() const; - Vector<String> filenames() const; - void addFilename(const String& filename, const String& displayName); - - // Used to handle files (images) being dragged out. - void addSharedBuffer(const String& name, PassRefPtr<SharedBuffer>); - - int modifierKeyState() const { return m_modifierKeyState; } - void setModifierKeyState(int modifierKeyState) { m_modifierKeyState = modifierKeyState; } - -private: - ChromiumDataObject(); - explicit ChromiumDataObject(const ChromiumDataObject&); - - PassRefPtr<ChromiumDataObjectItem> findStringItem(const String& type) const; - bool internalAddStringItem(PassRefPtr<ChromiumDataObjectItem>); - void internalAddFileItem(PassRefPtr<ChromiumDataObjectItem>); - - Vector<RefPtr<ChromiumDataObjectItem> > m_itemList; - - // State of Shift/Ctrl/Alt/Meta keys. - int m_modifierKeyState; -}; - -} // namespace WebCore - -#endif diff --git a/chromium/third_party/WebKit/Source/core/platform/chromium/ChromiumDataObjectItem.cpp b/chromium/third_party/WebKit/Source/core/platform/chromium/ChromiumDataObjectItem.cpp deleted file mode 100644 index bae44138447..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/chromium/ChromiumDataObjectItem.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "core/platform/chromium/ChromiumDataObjectItem.h" - -#include "core/dom/StringCallback.h" -#include "core/fileapi/Blob.h" -#include "core/platform/Pasteboard.h" -#include "platform/clipboard/ClipboardMimeTypes.h" -#include "public/platform/Platform.h" -#include "public/platform/WebClipboard.h" - -namespace WebCore { - -PassRefPtr<ChromiumDataObjectItem> ChromiumDataObjectItem::createFromString(const String& type, const String& data) -{ - RefPtr<ChromiumDataObjectItem> item = adoptRef(new ChromiumDataObjectItem(StringKind, type)); - item->m_data = data; - return item.release(); -} - -PassRefPtr<ChromiumDataObjectItem> ChromiumDataObjectItem::createFromFile(PassRefPtr<File> file) -{ - RefPtr<ChromiumDataObjectItem> item = adoptRef(new ChromiumDataObjectItem(FileKind, file->type())); - item->m_file = file; - return item.release(); -} - -PassRefPtr<ChromiumDataObjectItem> ChromiumDataObjectItem::createFromURL(const String& url, const String& title) -{ - RefPtr<ChromiumDataObjectItem> item = adoptRef(new ChromiumDataObjectItem(StringKind, mimeTypeTextURIList)); - item->m_data = url; - item->m_title = title; - return item.release(); -} - -PassRefPtr<ChromiumDataObjectItem> ChromiumDataObjectItem::createFromHTML(const String& html, const KURL& baseURL) -{ - RefPtr<ChromiumDataObjectItem> item = adoptRef(new ChromiumDataObjectItem(StringKind, mimeTypeTextHTML)); - item->m_data = html; - item->m_baseURL = baseURL; - return item.release(); -} - -PassRefPtr<ChromiumDataObjectItem> ChromiumDataObjectItem::createFromSharedBuffer(const String& name, PassRefPtr<SharedBuffer> buffer) -{ - RefPtr<ChromiumDataObjectItem> item = adoptRef(new ChromiumDataObjectItem(FileKind, String())); - item->m_sharedBuffer = buffer; - item->m_title = name; - return item.release(); -} - -PassRefPtr<ChromiumDataObjectItem> ChromiumDataObjectItem::createFromPasteboard(const String& type, uint64_t sequenceNumber) -{ - if (type == mimeTypeImagePng) - return adoptRef(new ChromiumDataObjectItem(FileKind, type, sequenceNumber)); - return adoptRef(new ChromiumDataObjectItem(StringKind, type, sequenceNumber)); -} - -ChromiumDataObjectItem::ChromiumDataObjectItem(Kind kind, const String& type) - : m_source(InternalSource) - , m_kind(kind) - , m_type(type) - , m_sequenceNumber(0) -{ -} - -ChromiumDataObjectItem::ChromiumDataObjectItem(Kind kind, const String& type, uint64_t sequenceNumber) - : m_source(PasteboardSource) - , m_kind(kind) - , m_type(type) - , m_sequenceNumber(sequenceNumber) -{ -} - -void ChromiumDataObjectItem::getAsString(PassOwnPtr<StringCallback> callback, ExecutionContext* context) const -{ - if (!callback || kind() != StringKind) - return; - - StringCallback::scheduleCallback(callback, context, internalGetAsString()); -} - -PassRefPtr<Blob> ChromiumDataObjectItem::getAsFile() const -{ - if (kind() != FileKind) - return 0; - - if (m_source == InternalSource) { - if (m_file) - return m_file; - ASSERT(m_sharedBuffer); - // FIXME: This code is currently impossible--we never populate m_sharedBuffer when dragging - // in. At some point though, we may need to support correctly converting a shared buffer - // into a file. - return 0; - } - - ASSERT(m_source == PasteboardSource); - if (type() == mimeTypeImagePng) { - // FIXME: This is pretty inefficient. We copy the data from the browser - // to the renderer. We then place it in a blob in WebKit, which - // registers it and copies it *back* to the browser. When a consumer - // wants to read the data, we then copy the data back into the renderer. - // https://bugs.webkit.org/show_bug.cgi?id=58107 has been filed to track - // improvements to this code (in particular, add a registerClipboardBlob - // method to the blob registry; that way the data is only copied over - // into the renderer when it's actually read, not when the blob is - // initially constructed). - RefPtr<SharedBuffer> data = static_cast<PassRefPtr<SharedBuffer> >(blink::Platform::current()->clipboard()->readImage(blink::WebClipboard::BufferStandard)); - RefPtr<RawData> rawData = RawData::create(); - rawData->mutableData()->append(data->data(), data->size()); - OwnPtr<BlobData> blobData = BlobData::create(); - blobData->appendData(rawData, 0, -1); - blobData->setContentType(mimeTypeImagePng); - return Blob::create(BlobDataHandle::create(blobData.release(), data->size())); - } - - return 0; -} - -String ChromiumDataObjectItem::internalGetAsString() const -{ - ASSERT(m_kind == StringKind); - - if (m_source == InternalSource) - return m_data; - - ASSERT(m_source == PasteboardSource); - - blink::WebClipboard::Buffer buffer = Pasteboard::generalPasteboard()->buffer(); - String data; - // This is ugly but there's no real alternative. - if (m_type == mimeTypeTextPlain) - data = blink::Platform::current()->clipboard()->readPlainText(buffer); - else if (m_type == mimeTypeTextHTML) { - blink::WebURL ignoredSourceURL; - unsigned ignored; - data = blink::Platform::current()->clipboard()->readHTML(buffer, &ignoredSourceURL, &ignored, &ignored); - } else - data = blink::Platform::current()->clipboard()->readCustomData(buffer, m_type); - - return blink::Platform::current()->clipboard()->sequenceNumber(buffer) == m_sequenceNumber ? data : String(); -} - -bool ChromiumDataObjectItem::isFilename() const -{ - // FIXME: https://bugs.webkit.org/show_bug.cgi?id=81261: When we properly support File dragout, - // we'll need to make sure this works as expected for DragDataChromium. - return m_kind == FileKind && m_file; -} - -} // namespace WebCore - diff --git a/chromium/third_party/WebKit/Source/core/platform/chromium/ChromiumDataObjectItem.h b/chromium/third_party/WebKit/Source/core/platform/chromium/ChromiumDataObjectItem.h deleted file mode 100644 index ecd328d54ab..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/chromium/ChromiumDataObjectItem.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef ChromiumDataObjectItem_h -#define ChromiumDataObjectItem_h - -#include "core/fileapi/File.h" -#include "platform/SharedBuffer.h" -#include "platform/weborigin/KURL.h" -#include "wtf/RefCounted.h" -#include "wtf/RefPtr.h" -#include "wtf/text/WTFString.h" - -namespace WebCore { - -class Blob; -class ExecutionContext; -class StringCallback; - -class ChromiumDataObjectItem : public RefCounted<ChromiumDataObjectItem> { -public: - enum Kind { - StringKind, - FileKind - }; - - static PassRefPtr<ChromiumDataObjectItem> createFromString(const String& type, const String& data); - static PassRefPtr<ChromiumDataObjectItem> createFromFile(PassRefPtr<File>); - static PassRefPtr<ChromiumDataObjectItem> createFromURL(const String& url, const String& title); - static PassRefPtr<ChromiumDataObjectItem> createFromHTML(const String& html, const KURL& baseURL); - static PassRefPtr<ChromiumDataObjectItem> createFromSharedBuffer(const String& filename, PassRefPtr<SharedBuffer>); - static PassRefPtr<ChromiumDataObjectItem> createFromPasteboard(const String& type, uint64_t sequenceNumber); - - Kind kind() const { return m_kind; } - String type() const { return m_type; } - void getAsString(PassOwnPtr<StringCallback>, ExecutionContext*) const; - PassRefPtr<Blob> getAsFile() const; - - // Used to support legacy DataTransfer APIs and renderer->browser serialization. - String internalGetAsString() const; - PassRefPtr<SharedBuffer> sharedBuffer() const { return m_sharedBuffer; } - String title() const { return m_title; } - KURL baseURL() const { return m_baseURL; } - bool isFilename() const; - -private: - enum DataSource { - PasteboardSource, - InternalSource, - }; - - ChromiumDataObjectItem(Kind, const String& type); - ChromiumDataObjectItem(Kind, const String& type, uint64_t sequenceNumber); - - DataSource m_source; - Kind m_kind; - String m_type; - - String m_data; - RefPtr<File> m_file; - RefPtr<SharedBuffer> m_sharedBuffer; - // Optional metadata. Currently used for URL, HTML, and dragging files in. - String m_title; - KURL m_baseURL; - - uint64_t m_sequenceNumber; // Only valid when m_source == PasteboardSource -}; - -} // namespace WebCore - -#endif // ChromiumDataObjectItem_h diff --git a/chromium/third_party/WebKit/Source/core/platform/chromium/KeyCodeConversion.h b/chromium/third_party/WebKit/Source/core/platform/chromium/KeyCodeConversion.h deleted file mode 100644 index 0257f5b93a2..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/chromium/KeyCodeConversion.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2008, 2009, Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef KeyCodeConversion_h -#define KeyCodeConversion_h - -namespace WebCore { - - int windowsKeyCodeForKeyEvent(unsigned keycode); - -} // namespace WebCore - -#endif diff --git a/chromium/third_party/WebKit/Source/core/platform/chromium/KeyCodeConversionAndroid.cpp b/chromium/third_party/WebKit/Source/core/platform/chromium/KeyCodeConversionAndroid.cpp deleted file mode 100644 index ae5a2869c9c..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/chromium/KeyCodeConversionAndroid.cpp +++ /dev/null @@ -1,329 +0,0 @@ -/* - * Copyright 2007, The Android Open Source Project - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. - * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com - * Copyright (C) 2007 Holger Hans Peter Freyther - * Copyright (C) 2008 Collabora, Ltd. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "platform/KeyboardCodes.h" - -#include <android/keycodes.h> - -namespace WebCore { - -// The Android NDK does not provide values for these yet: -enum { - AKEYCODE_ESCAPE = 111, - AKEYCODE_FORWARD_DEL = 112, - AKEYCODE_CTRL_LEFT = 113, - AKEYCODE_CTRL_RIGHT = 114, - AKEYCODE_CAPS_LOCK = 115, - AKEYCODE_SCROLL_LOCK = 116, - AKEYCODE_META_LEFT = 117, - AKEYCODE_META_RIGHT = 118, - AKEYCODE_BREAK = 121, - AKEYCODE_INSERT = 124, - AKEYCODE_MEDIA_PLAY = 126, - AKEYCODE_MEDIA_PAUSE = 127, - AKEYCODE_F1 = 131, - AKEYCODE_F2 = 132, - AKEYCODE_F3 = 133, - AKEYCODE_F4 = 134, - AKEYCODE_F5 = 135, - AKEYCODE_F6 = 136, - AKEYCODE_F7 = 137, - AKEYCODE_F8 = 138, - AKEYCODE_F9 = 139, - AKEYCODE_F10 = 140, - AKEYCODE_F11 = 141, - AKEYCODE_F12 = 142, - AKEYCODE_NUM_LOCK = 143, - AKEYCODE_NUMPAD_0 = 144, - AKEYCODE_NUMPAD_1 = 145, - AKEYCODE_NUMPAD_2 = 146, - AKEYCODE_NUMPAD_3 = 147, - AKEYCODE_NUMPAD_4 = 148, - AKEYCODE_NUMPAD_5 = 149, - AKEYCODE_NUMPAD_6 = 150, - AKEYCODE_NUMPAD_7 = 151, - AKEYCODE_NUMPAD_8 = 152, - AKEYCODE_NUMPAD_9 = 153, - AKEYCODE_NUMPAD_DIVIDE = 154, - AKEYCODE_NUMPAD_MULTIPLY = 155, - AKEYCODE_NUMPAD_SUBTRACT = 156, - AKEYCODE_NUMPAD_ADD = 157, - AKEYCODE_NUMPAD_DOT = 158, - AKEYCODE_VOLUME_MUTE = 164, - AKEYCODE_CHANNEL_UP = 166, - AKEYCODE_CHANNEL_DOWN = 167, -}; - -int windowsKeyCodeForKeyEvent(unsigned int keyCode) -{ - // Does not provide all key codes, and does not handle all keys. - switch (keyCode) { - case AKEYCODE_DEL: - return VKEY_BACK; - case AKEYCODE_TAB: - return VKEY_TAB; - case AKEYCODE_CLEAR: - return VKEY_CLEAR; - case AKEYCODE_DPAD_CENTER: - case AKEYCODE_ENTER: - return VKEY_RETURN; - case AKEYCODE_SHIFT_LEFT: - return VKEY_LSHIFT; - case AKEYCODE_SHIFT_RIGHT: - return VKEY_RSHIFT; - // Back will serve as escape, although we may not have access to it. - case AKEYCODE_BACK: - return VKEY_ESCAPE; - case AKEYCODE_SPACE: - return VKEY_SPACE; - case AKEYCODE_HOME: - return VKEY_HOME; - case AKEYCODE_DPAD_LEFT: - return VKEY_LEFT; - case AKEYCODE_DPAD_UP: - return VKEY_UP; - case AKEYCODE_DPAD_RIGHT: - return VKEY_RIGHT; - case AKEYCODE_DPAD_DOWN: - return VKEY_DOWN; - case AKEYCODE_0: - return VKEY_0; - case AKEYCODE_1: - return VKEY_1; - case AKEYCODE_2: - return VKEY_2; - case AKEYCODE_3: - return VKEY_3; - case AKEYCODE_4: - return VKEY_4; - case AKEYCODE_5: - return VKEY_5; - case AKEYCODE_6: - return VKEY_6; - case AKEYCODE_7: - return VKEY_7; - case AKEYCODE_8: - return VKEY_8; - case AKEYCODE_9: - return VKEY_9; - case AKEYCODE_A: - return VKEY_A; - case AKEYCODE_B: - return VKEY_B; - case AKEYCODE_C: - return VKEY_C; - case AKEYCODE_D: - return VKEY_D; - case AKEYCODE_E: - return VKEY_E; - case AKEYCODE_F: - return VKEY_F; - case AKEYCODE_G: - return VKEY_G; - case AKEYCODE_H: - return VKEY_H; - case AKEYCODE_I: - return VKEY_I; - case AKEYCODE_J: - return VKEY_J; - case AKEYCODE_K: - return VKEY_K; - case AKEYCODE_L: - return VKEY_L; - case AKEYCODE_M: - return VKEY_M; - case AKEYCODE_N: - return VKEY_N; - case AKEYCODE_O: - return VKEY_O; - case AKEYCODE_P: - return VKEY_P; - case AKEYCODE_Q: - return VKEY_Q; - case AKEYCODE_R: - return VKEY_R; - case AKEYCODE_S: - return VKEY_S; - case AKEYCODE_T: - return VKEY_T; - case AKEYCODE_U: - return VKEY_U; - case AKEYCODE_V: - return VKEY_V; - case AKEYCODE_W: - return VKEY_W; - case AKEYCODE_X: - return VKEY_X; - case AKEYCODE_Y: - return VKEY_Y; - case AKEYCODE_Z: - return VKEY_Z; - case AKEYCODE_VOLUME_DOWN: - return VKEY_VOLUME_DOWN; - case AKEYCODE_VOLUME_UP: - return VKEY_VOLUME_UP; - case AKEYCODE_MEDIA_NEXT: - return VKEY_MEDIA_NEXT_TRACK; - case AKEYCODE_MEDIA_PREVIOUS: - return VKEY_MEDIA_PREV_TRACK; - case AKEYCODE_MEDIA_STOP: - return VKEY_MEDIA_STOP; - case AKEYCODE_MEDIA_PAUSE: - return VKEY_MEDIA_PLAY_PAUSE; - // Colon key. - case AKEYCODE_SEMICOLON: - return VKEY_OEM_1; - case AKEYCODE_COMMA: - return VKEY_OEM_COMMA; - case AKEYCODE_MINUS: - return VKEY_OEM_MINUS; - case AKEYCODE_EQUALS: - return VKEY_OEM_PLUS; - case AKEYCODE_PERIOD: - return VKEY_OEM_PERIOD; - case AKEYCODE_SLASH: - return VKEY_OEM_2; - case AKEYCODE_LEFT_BRACKET: - return VKEY_OEM_4; - case AKEYCODE_BACKSLASH: - return VKEY_OEM_5; - case AKEYCODE_RIGHT_BRACKET: - return VKEY_OEM_6; - case AKEYCODE_MUTE: - case AKEYCODE_VOLUME_MUTE: - return VKEY_VOLUME_MUTE; - case AKEYCODE_ESCAPE: - return VKEY_ESCAPE; - case AKEYCODE_MEDIA_PLAY: - case AKEYCODE_MEDIA_PLAY_PAUSE: - return VKEY_MEDIA_PLAY_PAUSE; - case AKEYCODE_CALL: - return VKEY_END; - case AKEYCODE_ALT_LEFT: - return VKEY_LMENU; - case AKEYCODE_ALT_RIGHT: - return VKEY_RMENU; - case AKEYCODE_GRAVE: - return VKEY_OEM_3; - case AKEYCODE_APOSTROPHE: - return VKEY_OEM_3; - case AKEYCODE_MEDIA_REWIND: - return VKEY_OEM_103; - case AKEYCODE_MEDIA_FAST_FORWARD: - return VKEY_OEM_104; - case AKEYCODE_PAGE_UP: - return VKEY_PRIOR; - case AKEYCODE_PAGE_DOWN: - return VKEY_NEXT; - case AKEYCODE_FORWARD_DEL: - return VKEY_DELETE; - case AKEYCODE_CTRL_LEFT: - return VKEY_LCONTROL; - case AKEYCODE_CTRL_RIGHT: - return VKEY_RCONTROL; - case AKEYCODE_CAPS_LOCK: - return VKEY_CAPITAL; - case AKEYCODE_SCROLL_LOCK: - return VKEY_SCROLL; - case AKEYCODE_META_LEFT: - return VKEY_LWIN; - case AKEYCODE_META_RIGHT: - return VKEY_RWIN; - case AKEYCODE_BREAK: - return VKEY_PAUSE; - case AKEYCODE_INSERT: - return VKEY_INSERT; - case AKEYCODE_F1: - return VKEY_F1; - case AKEYCODE_F2: - return VKEY_F2; - case AKEYCODE_F3: - return VKEY_F3; - case AKEYCODE_F4: - return VKEY_F4; - case AKEYCODE_F5: - return VKEY_F5; - case AKEYCODE_F6: - return VKEY_F6; - case AKEYCODE_F7: - return VKEY_F7; - case AKEYCODE_F8: - return VKEY_F8; - case AKEYCODE_F9: - return VKEY_F9; - case AKEYCODE_F10: - return VKEY_F10; - case AKEYCODE_F11: - return VKEY_F11; - case AKEYCODE_F12: - return VKEY_F12; - case AKEYCODE_NUM_LOCK: - return VKEY_NUMLOCK; - case AKEYCODE_NUMPAD_0: - return VKEY_NUMPAD0; - case AKEYCODE_NUMPAD_1: - return VKEY_NUMPAD1; - case AKEYCODE_NUMPAD_2: - return VKEY_NUMPAD2; - case AKEYCODE_NUMPAD_3: - return VKEY_NUMPAD3; - case AKEYCODE_NUMPAD_4: - return VKEY_NUMPAD4; - case AKEYCODE_NUMPAD_5: - return VKEY_NUMPAD5; - case AKEYCODE_NUMPAD_6: - return VKEY_NUMPAD6; - case AKEYCODE_NUMPAD_7: - return VKEY_NUMPAD7; - case AKEYCODE_NUMPAD_8: - return VKEY_NUMPAD8; - case AKEYCODE_NUMPAD_9: - return VKEY_NUMPAD9; - case AKEYCODE_NUMPAD_DIVIDE: - return VKEY_DIVIDE; - case AKEYCODE_NUMPAD_MULTIPLY: - return VKEY_MULTIPLY; - case AKEYCODE_NUMPAD_SUBTRACT: - return VKEY_SUBTRACT; - case AKEYCODE_NUMPAD_ADD: - return VKEY_ADD; - case AKEYCODE_NUMPAD_DOT: - return VKEY_DECIMAL; - case AKEYCODE_CHANNEL_UP: - return VKEY_PRIOR; - case AKEYCODE_CHANNEL_DOWN: - return VKEY_NEXT; - default: - return 0; - } -} - -} // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/platform/chromium/KeyCodeConversionGtk.cpp b/chromium/third_party/WebKit/Source/core/platform/chromium/KeyCodeConversionGtk.cpp deleted file mode 100644 index e20dabd62a6..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/chromium/KeyCodeConversionGtk.cpp +++ /dev/null @@ -1,436 +0,0 @@ -/* - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. - * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com - * Copyright (C) 2007 Holger Hans Peter Freyther - * Copyright (C) 2008 Collabora, Ltd. All rights reserved. - * Copyright (C) 2008, 2009 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// windowsKeyCodeForKeyEvent is copied from platform/gtk/KeyEventGtk.cpp - -#include "config.h" -#include "core/platform/chromium/KeyCodeConversion.h" - -#include "platform/KeyboardCodes.h" - -#include <gdk/gdkkeysyms.h> - -namespace WebCore { - -int windowsKeyCodeForKeyEvent(unsigned keycode) -{ - switch (keycode) { - case GDK_KP_0: - return VKEY_NUMPAD0; // (60) Numeric keypad 0 key - case GDK_KP_1: - return VKEY_NUMPAD1; // (61) Numeric keypad 1 key - case GDK_KP_2: - return VKEY_NUMPAD2; // (62) Numeric keypad 2 key - case GDK_KP_3: - return VKEY_NUMPAD3; // (63) Numeric keypad 3 key - case GDK_KP_4: - return VKEY_NUMPAD4; // (64) Numeric keypad 4 key - case GDK_KP_5: - return VKEY_NUMPAD5; //(65) Numeric keypad 5 key - case GDK_KP_6: - return VKEY_NUMPAD6; // (66) Numeric keypad 6 key - case GDK_KP_7: - return VKEY_NUMPAD7; // (67) Numeric keypad 7 key - case GDK_KP_8: - return VKEY_NUMPAD8; // (68) Numeric keypad 8 key - case GDK_KP_9: - return VKEY_NUMPAD9; // (69) Numeric keypad 9 key - case GDK_KP_Multiply: - return VKEY_MULTIPLY; // (6A) Multiply key - case GDK_KP_Add: - return VKEY_ADD; // (6B) Add key - case GDK_KP_Subtract: - return VKEY_SUBTRACT; // (6D) Subtract key - case GDK_KP_Decimal: - return VKEY_DECIMAL; // (6E) Decimal key - case GDK_KP_Divide: - return VKEY_DIVIDE; // (6F) Divide key - - case GDK_KP_Page_Up: - return VKEY_PRIOR; // (21) PAGE UP key - case GDK_KP_Page_Down: - return VKEY_NEXT; // (22) PAGE DOWN key - case GDK_KP_End: - return VKEY_END; // (23) END key - case GDK_KP_Home: - return VKEY_HOME; // (24) HOME key - case GDK_KP_Left: - return VKEY_LEFT; // (25) LEFT ARROW key - case GDK_KP_Up: - return VKEY_UP; // (26) UP ARROW key - case GDK_KP_Right: - return VKEY_RIGHT; // (27) RIGHT ARROW key - case GDK_KP_Down: - return VKEY_DOWN; // (28) DOWN ARROW key - case GDK_KP_Begin: - return VKEY_CLEAR; // (12) CLEAR key - case GDK_KP_Insert: - return VKEY_INSERT; // (45) INS key - case GDK_KP_Delete: - return VKEY_DELETE; // (46) DEL key - - case GDK_BackSpace: - return VKEY_BACK; // (08) BACKSPACE key - case GDK_ISO_Left_Tab: - case GDK_3270_BackTab: - case GDK_Tab: - return VKEY_TAB; // (09) TAB key - case GDK_Clear: - return VKEY_CLEAR; // (0C) CLEAR key - case GDK_ISO_Enter: - case GDK_KP_Enter: - case GDK_Return: - return VKEY_RETURN; //(0D) Return key - case GDK_Shift_L: - return VKEY_LSHIFT; // (A0) Left SHIFT key - case GDK_Shift_R: - return VKEY_RSHIFT; // (A1) Right SHIFT key - case GDK_Control_L: - return VKEY_LCONTROL; // (A2) Left CTRL key - case GDK_Control_R: - return VKEY_RCONTROL; // (A3) Right CTRL key - case GDK_Menu: - return VKEY_APPS; // (5D) Applications key (Natural keyboard) - case GDK_Alt_L: - case GDK_Meta_L: - return VKEY_LMENU; // (A4) Left ALT key - case GDK_Alt_R: - case GDK_Meta_R: - case GDK_ISO_Level3_Shift: - return VKEY_RMENU; // (A5) Right ALT key - - case GDK_Pause: - return VKEY_PAUSE; // (13) PAUSE key - case GDK_Caps_Lock: - return VKEY_CAPITAL; // (14) CAPS LOCK key - case GDK_Kana_Lock: - case GDK_Kana_Shift: - return VKEY_KANA; // (15) Input Method Editor (IME) Kana mode - case GDK_Hangul: - return VKEY_HANGUL; // VKEY_HANGUL (15) IME Hangul mode - // VKEY_JUNJA (17) IME Junja mode - // VKEY_FINAL (18) IME final mode - case GDK_Hangul_Hanja: - return VKEY_HANJA; // (19) IME Hanja mode - case GDK_Kanji: - return VKEY_KANJI; // (19) IME Kanji mode - case GDK_Escape: - return VKEY_ESCAPE; // (1B) ESC key - // VKEY_CONVERT (1C) IME convert - // VKEY_NONCONVERT (1D) IME nonconvert - // VKEY_ACCEPT (1E) IME accept - // VKEY_MODECHANGE (1F) IME mode change request - case GDK_space: - return VKEY_SPACE; // (20) SPACEBAR - case GDK_Page_Up: - return VKEY_PRIOR; // (21) PAGE UP key - case GDK_Page_Down: - return VKEY_NEXT; // (22) PAGE DOWN key - case GDK_End: - return VKEY_END; // (23) END key - case GDK_Home: - return VKEY_HOME; // (24) HOME key - case GDK_Left: - return VKEY_LEFT; // (25) LEFT ARROW key - case GDK_Up: - return VKEY_UP; // (26) UP ARROW key - case GDK_Right: - return VKEY_RIGHT; // (27) RIGHT ARROW key - case GDK_Down: - return VKEY_DOWN; // (28) DOWN ARROW key - case GDK_Select: - return VKEY_SELECT; // (29) SELECT key - case GDK_Print: - return VKEY_PRINT; // (2A) PRINT key - case GDK_Execute: - return VKEY_EXECUTE;// (2B) EXECUTE key - //dunno on this - //case GDK_PrintScreen: - // return VKEY_SNAPSHOT; // (2C) PRINT SCREEN key - case GDK_Insert: - return VKEY_INSERT; // (2D) INS key - case GDK_Delete: - return VKEY_DELETE; // (2E) DEL key - case GDK_Help: - return VKEY_HELP; // (2F) HELP key - case GDK_0: - case GDK_parenright: - return VKEY_0; // (30) 0) key - case GDK_1: - case GDK_exclam: - return VKEY_1; // (31) 1 ! key - case GDK_2: - case GDK_at: - return VKEY_2; // (32) 2 & key - case GDK_3: - case GDK_numbersign: - return VKEY_3; //case '3': case '#'; - case GDK_4: - case GDK_dollar: // (34) 4 key '$'; - return VKEY_4; - case GDK_5: - case GDK_percent: - return VKEY_5; // (35) 5 key '%' - case GDK_6: - case GDK_asciicircum: - return VKEY_6; // (36) 6 key '^' - case GDK_7: - case GDK_ampersand: - return VKEY_7; // (37) 7 key case '&' - case GDK_8: - case GDK_asterisk: - return VKEY_8; // (38) 8 key '*' - case GDK_9: - case GDK_parenleft: - return VKEY_9; // (39) 9 key '(' - case GDK_a: - case GDK_A: - return VKEY_A; // (41) A key case 'a': case 'A': return 0x41; - case GDK_b: - case GDK_B: - return VKEY_B; // (42) B key case 'b': case 'B': return 0x42; - case GDK_c: - case GDK_C: - return VKEY_C; // (43) C key case 'c': case 'C': return 0x43; - case GDK_d: - case GDK_D: - return VKEY_D; // (44) D key case 'd': case 'D': return 0x44; - case GDK_e: - case GDK_E: - return VKEY_E; // (45) E key case 'e': case 'E': return 0x45; - case GDK_f: - case GDK_F: - return VKEY_F; // (46) F key case 'f': case 'F': return 0x46; - case GDK_g: - case GDK_G: - return VKEY_G; // (47) G key case 'g': case 'G': return 0x47; - case GDK_h: - case GDK_H: - return VKEY_H; // (48) H key case 'h': case 'H': return 0x48; - case GDK_i: - case GDK_I: - return VKEY_I; // (49) I key case 'i': case 'I': return 0x49; - case GDK_j: - case GDK_J: - return VKEY_J; // (4A) J key case 'j': case 'J': return 0x4A; - case GDK_k: - case GDK_K: - return VKEY_K; // (4B) K key case 'k': case 'K': return 0x4B; - case GDK_l: - case GDK_L: - return VKEY_L; // (4C) L key case 'l': case 'L': return 0x4C; - case GDK_m: - case GDK_M: - return VKEY_M; // (4D) M key case 'm': case 'M': return 0x4D; - case GDK_n: - case GDK_N: - return VKEY_N; // (4E) N key case 'n': case 'N': return 0x4E; - case GDK_o: - case GDK_O: - return VKEY_O; // (4F) O key case 'o': case 'O': return 0x4F; - case GDK_p: - case GDK_P: - return VKEY_P; // (50) P key case 'p': case 'P': return 0x50; - case GDK_q: - case GDK_Q: - return VKEY_Q; // (51) Q key case 'q': case 'Q': return 0x51; - case GDK_r: - case GDK_R: - return VKEY_R; // (52) R key case 'r': case 'R': return 0x52; - case GDK_s: - case GDK_S: - return VKEY_S; // (53) S key case 's': case 'S': return 0x53; - case GDK_t: - case GDK_T: - return VKEY_T; // (54) T key case 't': case 'T': return 0x54; - case GDK_u: - case GDK_U: - return VKEY_U; // (55) U key case 'u': case 'U': return 0x55; - case GDK_v: - case GDK_V: - return VKEY_V; // (56) V key case 'v': case 'V': return 0x56; - case GDK_w: - case GDK_W: - return VKEY_W; // (57) W key case 'w': case 'W': return 0x57; - case GDK_x: - case GDK_X: - return VKEY_X; // (58) X key case 'x': case 'X': return 0x58; - case GDK_y: - case GDK_Y: - return VKEY_Y; // (59) Y key case 'y': case 'Y': return 0x59; - case GDK_z: - case GDK_Z: - return VKEY_Z; // (5A) Z key case 'z': case 'Z': return 0x5A; - case GDK_Super_L: - return VKEY_LWIN; // (5B) Left Windows key (Microsoft Natural keyboard) - case GDK_Super_R: - return VKEY_RWIN; // (5C) Right Windows key (Natural keyboard) - // VKEY_SLEEP (5F) Computer Sleep key - // VKEY_SEPARATOR (6C) Separator key - // VKEY_SUBTRACT (6D) Subtract key - // VKEY_DECIMAL (6E) Decimal key - // VKEY_DIVIDE (6F) Divide key - // handled by key code above - - case GDK_Num_Lock: - return VKEY_NUMLOCK; // (90) NUM LOCK key - - case GDK_Scroll_Lock: - return VKEY_SCROLL; // (91) SCROLL LOCK key - - // VKEY_LSHIFT (A0) Left SHIFT key - // VKEY_RSHIFT (A1) Right SHIFT key - // VKEY_LCONTROL (A2) Left CONTROL key - // VKEY_RCONTROL (A3) Right CONTROL key - // VKEY_LMENU (A4) Left MENU key - // VKEY_RMENU (A5) Right MENU key - case GDK_Back: - return VKEY_BROWSER_BACK; // (A6) Windows 2000/XP: Browser Back key - case GDK_Forward: - return VKEY_BROWSER_FORWARD; // (A7) Windows 2000/XP: Browser Forward key - case GDK_Refresh: - return VKEY_BROWSER_REFRESH; // (A8) Windows 2000/XP: Browser Refresh key - case GDK_Stop: - return VKEY_BROWSER_STOP; // (A9) Windows 2000/XP: Browser Stop key - case GDK_Search: - return VKEY_BROWSER_SEARCH; // (AA) Windows 2000/XP: Browser Search key - case GDK_Favorites: - return VKEY_BROWSER_FAVORITES; // (AB) Windows 2000/XP: Browser Favorites key - case GDK_HomePage: - return VKEY_BROWSER_HOME; // (AC) Windows 2000/XP: Browser Start and Home key - case GDK_AudioMute: - return VKEY_VOLUME_MUTE; // (AD) Windows 2000/XP: Volume Mute key - case GDK_AudioLowerVolume: - return VKEY_VOLUME_DOWN; // (AE) Windows 2000/XP: Volume Down key - case GDK_AudioRaiseVolume: - return VKEY_VOLUME_UP; // (AF) Windows 2000/XP: Volume Up key - case GDK_AudioNext: - return VKEY_MEDIA_NEXT_TRACK; // (B0) Windows 2000/XP: Next Track key - case GDK_AudioPrev: - return VKEY_MEDIA_PREV_TRACK; // (B1) Windows 2000/XP: Previous Track key - case GDK_AudioStop: - return VKEY_MEDIA_STOP; // (B2) Windows 2000/XP: Stop Media key - case GDK_AudioPlay: - return VKEY_MEDIA_PLAY_PAUSE; // (B3) Windows 2000/XP: Play/Pause Media key - case GDK_Mail: - return VKEY_MEDIA_LAUNCH_MAIL; // (B4) Windows 2000/XP: Start Mail key - // VKEY_LAUNCH_MEDIA_SELECT (B5) Windows 2000/XP: Select Media key - case GDK_LaunchA: - return VKEY_MEDIA_LAUNCH_APP1; // (B6) Windows 2000/XP: Start Application 1 key - case GDK_LaunchB: - return VKEY_MEDIA_LAUNCH_APP2; // (B7) Windows 2000/XP: Start Application 2 key - - // VKEY_OEM_1 (BA) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ';:' key - case GDK_semicolon: - case GDK_colon: - return VKEY_OEM_1; //case ';': case ':': return 0xBA; - // VKEY_OEM_PLUS (BB) Windows 2000/XP: For any country/region, the '+' key - case GDK_plus: - case GDK_equal: - return VKEY_OEM_PLUS; //case '=': case '+': return 0xBB; - // VKEY_OEM_COMMA (BC) Windows 2000/XP: For any country/region, the ',' key - case GDK_comma: - case GDK_less: - return VKEY_OEM_COMMA; //case ',': case '<': return 0xBC; - // VKEY_OEM_MINUS (BD) Windows 2000/XP: For any country/region, the '-' key - case GDK_minus: - case GDK_underscore: - return VKEY_OEM_MINUS; //case '-': case '_': return 0xBD; - // VKEY_OEM_PERIOD (BE) Windows 2000/XP: For any country/region, the '.' key - case GDK_period: - case GDK_greater: - return VKEY_OEM_PERIOD; //case '.': case '>': return 0xBE; - // VKEY_OEM_2 (BF) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '/?' key - case GDK_slash: - case GDK_question: - return VKEY_OEM_2; //case '/': case '?': return 0xBF; - // VKEY_OEM_3 (C0) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '`~' key - case GDK_asciitilde: - case GDK_quoteleft: - return VKEY_OEM_3; //case '`': case '~': return 0xC0; - // VKEY_OEM_4 (DB) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '[{' key - case GDK_bracketleft: - case GDK_braceleft: - return VKEY_OEM_4; //case '[': case '{': return 0xDB; - // VKEY_OEM_5 (DC) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '\|' key - case GDK_backslash: - case GDK_bar: - return VKEY_OEM_5; //case '\\': case '|': return 0xDC; - // VKEY_OEM_6 (DD) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ']}' key - case GDK_bracketright: - case GDK_braceright: - return VKEY_OEM_6; // case ']': case '}': return 0xDD; - // VKEY_OEM_7 (DE) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key - case GDK_quoteright: - case GDK_quotedbl: - return VKEY_OEM_7; // case '\'': case '"': return 0xDE; - // VKEY_OEM_8 (DF) Used for miscellaneous characters; it can vary by keyboard. - // VKEY_OEM_102 (E2) Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard - // VKEY_PROCESSKEY (E5) Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key - // VKEY_PACKET (E7) Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The VKEY_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT,SendInput, WM_KEYDOWN, and WM_KEYUP - // VKEY_ATTN (F6) Attn key - // VKEY_CRSEL (F7) CrSel key - // VKEY_EXSEL (F8) ExSel key - // VKEY_EREOF (F9) Erase EOF key - // VKEY_PLAY (FA) Play key - // VKEY_ZOOM (FB) Zoom key - // VKEY_NONAME (FC) Reserved for future use - // VKEY_PA1 (FD) PA1 key - // VKEY_OEM_CLEAR (FE) Clear key - case GDK_F1: - case GDK_F2: - case GDK_F3: - case GDK_F4: - case GDK_F5: - case GDK_F6: - case GDK_F7: - case GDK_F8: - case GDK_F9: - case GDK_F10: - case GDK_F11: - case GDK_F12: - case GDK_F13: - case GDK_F14: - case GDK_F15: - case GDK_F16: - case GDK_F17: - case GDK_F18: - case GDK_F19: - case GDK_F20: - case GDK_F21: - case GDK_F22: - case GDK_F23: - case GDK_F24: - return VKEY_F1 + (keycode - GDK_F1); - default: - return 0; - } -} - -} // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/platform/chromium/support/WebArrayBuffer.cpp b/chromium/third_party/WebKit/Source/core/platform/chromium/support/WebArrayBuffer.cpp deleted file mode 100644 index 05429fe8fa0..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/chromium/support/WebArrayBuffer.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "public/platform/WebArrayBuffer.h" - -#include "bindings/v8/custom/V8ArrayBufferCustom.h" -#include "wtf/ArrayBuffer.h" -#include "wtf/PassOwnPtr.h" - -using namespace WebCore; - -namespace blink { - -WebArrayBuffer WebArrayBuffer::create(unsigned numElements, unsigned elementByteSize) -{ - RefPtr<ArrayBuffer> buffer = ArrayBuffer::create(numElements, elementByteSize); - return WebArrayBuffer(buffer); -} - -void WebArrayBuffer::reset() -{ - m_private.reset(); -} - -void WebArrayBuffer::assign(const WebArrayBuffer& other) -{ - m_private = other.m_private; -} - -void* WebArrayBuffer::data() const -{ - if (!isNull()) - return const_cast<void*>(m_private->data()); - return 0; -} - -unsigned WebArrayBuffer::byteLength() const -{ - if (!isNull()) - return m_private->byteLength(); - return 0; -} - -v8::Handle<v8::Value> WebArrayBuffer::toV8Value() -{ - if (!m_private.get()) - return v8::Handle<v8::Value>(); - return toV8(m_private.get(), v8::Handle<v8::Object>(), v8::Isolate::GetCurrent()); -} - -WebArrayBuffer* WebArrayBuffer::createFromV8Value(v8::Handle<v8::Value> value) -{ - if (!V8ArrayBuffer::hasInstanceInAnyWorld(value, v8::Isolate::GetCurrent())) - return 0; - WTF::ArrayBuffer* buffer = V8ArrayBuffer::toNative(value->ToObject()); - return new WebArrayBuffer(buffer); -} - -WebArrayBuffer::WebArrayBuffer(const WTF::PassRefPtr<WTF::ArrayBuffer>& blob) - : m_private(blob) -{ -} - -WebArrayBuffer& WebArrayBuffer::operator=(const WTF::PassRefPtr<WTF::ArrayBuffer>& blob) -{ - m_private = blob; - return *this; -} - -WebArrayBuffer::operator WTF::PassRefPtr<WTF::ArrayBuffer>() const -{ - return m_private.get(); -} - -} // namespace blink diff --git a/chromium/third_party/WebKit/Source/core/platform/chromium/support/WebCrypto.cpp b/chromium/third_party/WebKit/Source/core/platform/chromium/support/WebCrypto.cpp deleted file mode 100644 index 3fd68afd82a..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/chromium/support/WebCrypto.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "public/platform/WebCrypto.h" - -#include "core/platform/CryptoResult.h" -#include "public/platform/WebArrayBuffer.h" -#include <string.h> - -namespace blink { - -void WebCryptoResult::completeWithError() -{ - m_impl->completeWithError(); - reset(); -} - -void WebCryptoResult::completeWithBuffer(const WebArrayBuffer& buffer) -{ - RELEASE_ASSERT(!buffer.isNull()); - m_impl->completeWithBuffer(buffer); - reset(); -} - -void WebCryptoResult::completeWithBuffer(const void* bytes, unsigned bytesSize) -{ - WebArrayBuffer buffer = blink::WebArrayBuffer::create(bytesSize, 1); - RELEASE_ASSERT(!buffer.isNull()); - memcpy(buffer.data(), bytes, bytesSize); - completeWithBuffer(buffer); -} - -void WebCryptoResult::completeWithBoolean(bool b) -{ - m_impl->completeWithBoolean(b); - reset(); -} - -void WebCryptoResult::completeWithKey(const WebCryptoKey& key) -{ - ASSERT(!key.isNull()); - m_impl->completeWithKey(key); - reset(); -} - -void WebCryptoResult::completeWithKeyPair(const WebCryptoKey& publicKey, const WebCryptoKey& privateKey) -{ - ASSERT(!publicKey.isNull()); - ASSERT(!privateKey.isNull()); - m_impl->completeWithKeyPair(publicKey, privateKey); - reset(); -} - -WebCryptoResult::WebCryptoResult(const WTF::PassRefPtr<WebCore::CryptoResult>& impl) - : m_impl(impl) -{ - ASSERT(m_impl.get()); -} - -void WebCryptoResult::reset() -{ - m_impl.reset(); -} - -void WebCryptoResult::assign(const WebCryptoResult& o) -{ - m_impl = o.m_impl; -} - -} // namespace blink diff --git a/chromium/third_party/WebKit/Source/core/platform/chromium/support/WebMediaStream.cpp b/chromium/third_party/WebKit/Source/core/platform/chromium/support/WebMediaStream.cpp deleted file mode 100644 index 7572def9072..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/chromium/support/WebMediaStream.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#include "public/platform/WebMediaStream.h" - -#include "core/platform/mediastream/MediaStreamDescriptor.h" -#include "platform/UUID.h" -#include "platform/mediastream/MediaStreamComponent.h" -#include "platform/mediastream/MediaStreamSource.h" -#include "public/platform/WebMediaStreamSource.h" -#include "public/platform/WebMediaStreamTrack.h" -#include "public/platform/WebString.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" -#include "wtf/Vector.h" - -using namespace WebCore; - -namespace blink { - -namespace { - -class ExtraDataContainer : public MediaStreamDescriptor::ExtraData { -public: - ExtraDataContainer(WebMediaStream::ExtraData* extraData) : m_extraData(adoptPtr(extraData)) { } - - WebMediaStream::ExtraData* extraData() { return m_extraData.get(); } - -private: - OwnPtr<WebMediaStream::ExtraData> m_extraData; -}; - -} // namespace - -WebMediaStream::WebMediaStream(const PassRefPtr<WebCore::MediaStreamDescriptor>& mediaStreamDescriptor) - : m_private(mediaStreamDescriptor) -{ -} - -WebMediaStream::WebMediaStream(WebCore::MediaStreamDescriptor* mediaStreamDescriptor) - : m_private(mediaStreamDescriptor) -{ -} - -void WebMediaStream::reset() -{ - m_private.reset(); -} - -WebString WebMediaStream::id() const -{ - return m_private->id(); -} - -WebMediaStream::ExtraData* WebMediaStream::extraData() const -{ - RefPtr<MediaStreamDescriptor::ExtraData> data = m_private->extraData(); - if (!data) - return 0; - return static_cast<ExtraDataContainer*>(data.get())->extraData(); -} - -void WebMediaStream::setExtraData(ExtraData* extraData) -{ - m_private->setExtraData(adoptRef(new ExtraDataContainer(extraData))); -} - -void WebMediaStream::audioTracks(WebVector<WebMediaStreamTrack>& webTracks) const -{ - size_t numberOfTracks = m_private->numberOfAudioComponents(); - WebVector<WebMediaStreamTrack> result(numberOfTracks); - for (size_t i = 0; i < numberOfTracks; ++i) - result[i] = m_private->audioComponent(i); - webTracks.swap(result); -} - -void WebMediaStream::videoTracks(WebVector<WebMediaStreamTrack>& webTracks) const -{ - size_t numberOfTracks = m_private->numberOfVideoComponents(); - WebVector<WebMediaStreamTrack> result(numberOfTracks); - for (size_t i = 0; i < numberOfTracks; ++i) - result[i] = m_private->videoComponent(i); - webTracks.swap(result); -} - -void WebMediaStream::addTrack(const WebMediaStreamTrack& track) -{ - ASSERT(!isNull()); - m_private->addRemoteTrack(track); -} - -void WebMediaStream::removeTrack(const WebMediaStreamTrack& track) -{ - ASSERT(!isNull()); - m_private->removeRemoteTrack(track); -} - -WebMediaStream& WebMediaStream::operator=(const PassRefPtr<WebCore::MediaStreamDescriptor>& mediaStreamDescriptor) -{ - m_private = mediaStreamDescriptor; - return *this; -} - -WebMediaStream::operator PassRefPtr<WebCore::MediaStreamDescriptor>() const -{ - return m_private.get(); -} - -WebMediaStream::operator WebCore::MediaStreamDescriptor*() const -{ - return m_private.get(); -} - -void WebMediaStream::initialize(const WebVector<WebMediaStreamTrack>& audioTracks, const WebVector<WebMediaStreamTrack>& videoTracks) -{ - initialize(createCanonicalUUIDString(), audioTracks, videoTracks); -} - -void WebMediaStream::initialize(const WebString& label, const WebVector<WebMediaStreamTrack>& audioTracks, const WebVector<WebMediaStreamTrack>& videoTracks) -{ - MediaStreamComponentVector audio, video; - for (size_t i = 0; i < audioTracks.size(); ++i) { - MediaStreamComponent* component = audioTracks[i]; - audio.append(component); - } - for (size_t i = 0; i < videoTracks.size(); ++i) { - MediaStreamComponent* component = videoTracks[i]; - video.append(component); - } - m_private = MediaStreamDescriptor::create(label, audio, video); -} - -void WebMediaStream::assign(const WebMediaStream& other) -{ - m_private = other.m_private; -} - -} // namespace blink diff --git a/chromium/third_party/WebKit/Source/core/platform/chromium/support/WebMediaStreamTrack.cpp b/chromium/third_party/WebKit/Source/core/platform/chromium/support/WebMediaStreamTrack.cpp deleted file mode 100644 index 39dabdfa8f3..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/chromium/support/WebMediaStreamTrack.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#include "public/platform/WebMediaStreamTrack.h" - -#include "platform/mediastream/MediaStreamComponent.h" -#include "platform/mediastream/MediaStreamSource.h" -#include "public/platform/WebAudioSourceProvider.h" -#include "public/platform/WebMediaStream.h" -#include "public/platform/WebMediaStreamSource.h" -#include "public/platform/WebString.h" -#include "wtf/Vector.h" - -using namespace WebCore; - -namespace blink { - -namespace { - -class ExtraDataContainer : public MediaStreamComponent::ExtraData { -public: - explicit ExtraDataContainer(PassOwnPtr<WebMediaStreamTrack::ExtraData> extraData) : m_extraData(extraData) { } - - WebMediaStreamTrack::ExtraData* extraData() { return m_extraData.get(); } - -private: - OwnPtr<WebMediaStreamTrack::ExtraData> m_extraData; -}; - -} // namespace - -WebMediaStreamTrack::WebMediaStreamTrack(PassRefPtr<WebCore::MediaStreamComponent> mediaStreamComponent) - : m_private(mediaStreamComponent) -{ -} - -WebMediaStreamTrack::WebMediaStreamTrack(WebCore::MediaStreamComponent* mediaStreamComponent) - : m_private(mediaStreamComponent) -{ -} - -WebMediaStreamTrack& WebMediaStreamTrack::operator=(WebCore::MediaStreamComponent* mediaStreamComponent) -{ - m_private = mediaStreamComponent; - return *this; -} - -void WebMediaStreamTrack::initialize(const WebMediaStreamSource& source) -{ - m_private = MediaStreamComponent::create(source); -} - -void WebMediaStreamTrack::initialize(const WebString& id, const WebMediaStreamSource& source) -{ - m_private = MediaStreamComponent::create(id, source); -} - -void WebMediaStreamTrack::reset() -{ - m_private.reset(); -} - -WebMediaStreamTrack::operator PassRefPtr<MediaStreamComponent>() const -{ - return m_private.get(); -} - -WebMediaStreamTrack::operator MediaStreamComponent*() const -{ - return m_private.get(); -} - -bool WebMediaStreamTrack::isEnabled() const -{ - ASSERT(!m_private.isNull()); - return m_private->enabled(); -} - -WebString WebMediaStreamTrack::id() const -{ - ASSERT(!m_private.isNull()); - return m_private->id(); -} - -WebMediaStream WebMediaStreamTrack::stream() const -{ - ASSERT(!m_private.isNull()); - return WebMediaStream(m_private->stream()); -} - -WebMediaStreamSource WebMediaStreamTrack::source() const -{ - ASSERT(!m_private.isNull()); - return WebMediaStreamSource(m_private->source()); -} - -WebMediaStreamTrack::ExtraData* WebMediaStreamTrack::extraData() const -{ - RefPtr<MediaStreamComponent::ExtraData> data = m_private->extraData(); - if (!data) - return 0; - return static_cast<ExtraDataContainer*>(data.get())->extraData(); -} - -void WebMediaStreamTrack::setExtraData(ExtraData* extraData) -{ - m_private->setExtraData(adoptRef(new ExtraDataContainer(adoptPtr(extraData)))); -} - -void WebMediaStreamTrack::setSourceProvider(WebAudioSourceProvider* provider) -{ -#if ENABLE(WEB_AUDIO) - ASSERT(!m_private.isNull()); - m_private->setSourceProvider(provider); -#endif // ENABLE(WEB_AUDIO) -} - -void WebMediaStreamTrack::assign(const WebMediaStreamTrack& other) -{ - m_private = other.m_private; -} - -} // namespace blink diff --git a/chromium/third_party/WebKit/Source/core/platform/chromium/support/WebRTCSessionDescription.cpp b/chromium/third_party/WebKit/Source/core/platform/chromium/support/WebRTCSessionDescription.cpp deleted file mode 100644 index 1fc0cafec96..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/chromium/support/WebRTCSessionDescription.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#include "public/platform/WebRTCSessionDescription.h" - -#include "wtf/PassRefPtr.h" -#include "wtf/RefCounted.h" -#include "public/platform/WebString.h" - -namespace blink { - -class WebRTCSessionDescriptionPrivate FINAL : public RefCounted<WebRTCSessionDescriptionPrivate> { -public: - static PassRefPtr<WebRTCSessionDescriptionPrivate> create(const WebString& type, const WebString& sdp); - - WebString type() { return m_type; } - void setType(const WebString& type) { m_type = type; } - - WebString sdp() { return m_sdp; } - void setSdp(const WebString& sdp) { m_sdp = sdp; } - -private: - WebRTCSessionDescriptionPrivate(const WebString& type, const WebString& sdp); - - WebString m_type; - WebString m_sdp; -}; - -PassRefPtr<WebRTCSessionDescriptionPrivate> WebRTCSessionDescriptionPrivate::create(const WebString& type, const WebString& sdp) -{ - return adoptRef(new WebRTCSessionDescriptionPrivate(type, sdp)); -} - -WebRTCSessionDescriptionPrivate::WebRTCSessionDescriptionPrivate(const WebString& type, const WebString& sdp) - : m_type(type) - , m_sdp(sdp) -{ -} - -void WebRTCSessionDescription::assign(const WebRTCSessionDescription& other) -{ - m_private = other.m_private; -} - -void WebRTCSessionDescription::reset() -{ - m_private.reset(); -} - -void WebRTCSessionDescription::initialize(const WebString& type, const WebString& sdp) -{ - m_private = WebRTCSessionDescriptionPrivate::create(type, sdp); -} - -WebString WebRTCSessionDescription::type() const -{ - ASSERT(!m_private.isNull()); - return m_private->type(); -} - -void WebRTCSessionDescription::setType(const WebString& type) -{ - ASSERT(!m_private.isNull()); - return m_private->setType(type); -} - -WebString WebRTCSessionDescription::sdp() const -{ - ASSERT(!m_private.isNull()); - return m_private->sdp(); -} - -void WebRTCSessionDescription::setSDP(const WebString& sdp) -{ - ASSERT(!m_private.isNull()); - return m_private->setSdp(sdp); -} - -} // namespace blink - diff --git a/chromium/third_party/WebKit/Source/core/platform/chromium/support/WebRTCSessionDescriptionRequest.cpp b/chromium/third_party/WebKit/Source/core/platform/chromium/support/WebRTCSessionDescriptionRequest.cpp deleted file mode 100644 index b35f305ff1f..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/chromium/support/WebRTCSessionDescriptionRequest.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#include "public/platform/WebRTCSessionDescriptionRequest.h" - -#include "platform/mediastream/RTCSessionDescriptionRequest.h" -#include "public/platform/WebRTCSessionDescription.h" -#include "wtf/PassOwnPtr.h" - -using namespace WebCore; - -namespace blink { - -namespace { - -class ExtraDataContainer : public RTCSessionDescriptionRequest::ExtraData { -public: - ExtraDataContainer(WebRTCSessionDescriptionRequest::ExtraData* extraData) : m_extraData(adoptPtr(extraData)) { } - - WebRTCSessionDescriptionRequest::ExtraData* extraData() { return m_extraData.get(); } - -private: - OwnPtr<WebRTCSessionDescriptionRequest::ExtraData> m_extraData; -}; - -} // namespace - -WebRTCSessionDescriptionRequest::WebRTCSessionDescriptionRequest(const PassRefPtr<RTCSessionDescriptionRequest>& constraints) - : m_private(constraints) -{ -} - -void WebRTCSessionDescriptionRequest::assign(const WebRTCSessionDescriptionRequest& other) -{ - m_private = other.m_private; -} - -void WebRTCSessionDescriptionRequest::reset() -{ - m_private.reset(); -} - -void WebRTCSessionDescriptionRequest::requestSucceeded(const WebRTCSessionDescription& sessionDescription) const -{ - ASSERT(m_private.get()); - m_private->requestSucceeded(sessionDescription); -} - -void WebRTCSessionDescriptionRequest::requestFailed(const WebString& error) const -{ - ASSERT(m_private.get()); - m_private->requestFailed(error); -} - -WebRTCSessionDescriptionRequest::ExtraData* WebRTCSessionDescriptionRequest::extraData() const -{ - RefPtr<RTCSessionDescriptionRequest::ExtraData> data = m_private->extraData(); - if (!data) - return 0; - return static_cast<ExtraDataContainer*>(data.get())->extraData(); -} - -void WebRTCSessionDescriptionRequest::setExtraData(ExtraData* extraData) -{ - m_private->setExtraData(adoptRef(new ExtraDataContainer(extraData))); -} - -} // namespace blink - diff --git a/chromium/third_party/WebKit/Source/core/platform/chromium/support/WebRTCStatsRequest.cpp b/chromium/third_party/WebKit/Source/core/platform/chromium/support/WebRTCStatsRequest.cpp deleted file mode 100644 index 617bd56256c..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/chromium/support/WebRTCStatsRequest.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#include "public/platform/WebRTCStatsRequest.h" - -#include "core/platform/mediastream/RTCStatsRequest.h" -#include "modules/mediastream/RTCStatsResponse.h" -#include "public/platform/WebMediaStream.h" -#include "public/platform/WebMediaStreamTrack.h" -#include "public/platform/WebRTCStatsResponse.h" -#include "wtf/PassOwnPtr.h" - -using namespace WebCore; - -namespace blink { - -WebRTCStatsRequest::WebRTCStatsRequest(const PassRefPtr<RTCStatsRequest>& request) - : m_private(request) -{ -} - -void WebRTCStatsRequest::assign(const WebRTCStatsRequest& other) -{ - m_private = other.m_private; -} - -void WebRTCStatsRequest::reset() -{ - m_private.reset(); -} - -WebRTCStatsResponse WebRTCStatsRequest::createResponse() const -{ - return WebRTCStatsResponse(m_private->createResponse()); -} - -bool WebRTCStatsRequest::hasSelector() const -{ - return m_private->hasSelector(); -} - -const WebMediaStream WebRTCStatsRequest::stream() const -{ - return WebMediaStream(m_private->stream()); -} - -const WebMediaStreamTrack WebRTCStatsRequest::component() const -{ - return WebMediaStreamTrack(m_private->component()); -} - -void WebRTCStatsRequest::requestSucceeded(const WebRTCStatsResponse& response) const -{ - m_private->requestSucceeded(response); -} - -} // namespace blink diff --git a/chromium/third_party/WebKit/Source/core/platform/mac/ThemeMac.h b/chromium/third_party/WebKit/Source/core/platform/mac/ThemeMac.h deleted file mode 100644 index 3e4d44b2934..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/mac/ThemeMac.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef ThemeMac_h -#define ThemeMac_h - -#include "platform/Theme.h" - -@interface NSFont(WebCoreTheme) -- (NSString*)webCoreFamilyName; -@end - -namespace WebCore { - -class ThemeMac : public Theme { -public: - ThemeMac() { } - virtual ~ThemeMac() { } - - virtual int baselinePositionAdjustment(ControlPart) const; - - virtual FontDescription controlFont(ControlPart, const FontDescription&, float zoomFactor) const; - - virtual LengthSize controlSize(ControlPart, const FontDescription&, const LengthSize&, float zoomFactor) const; - virtual LengthSize minimumControlSize(ControlPart, const FontDescription&, float zoomFactor) const; - - virtual LengthBox controlPadding(ControlPart, const FontDescription&, const LengthBox& zoomedBox, float zoomFactor) const; - virtual LengthBox controlBorder(ControlPart, const FontDescription&, const LengthBox& zoomedBox, float zoomFactor) const; - - virtual bool controlRequiresPreWhiteSpace(ControlPart part) const { return part == PushButtonPart; } - - virtual void paint(ControlPart, ControlStates, GraphicsContext*, const IntRect&, float zoomFactor, ScrollView*) const; - virtual void inflateControlPaintRect(ControlPart, ControlStates, IntRect&, float zoomFactor) const; - - // FIXME: Once RenderThemeMac is converted over to use Theme then this can be internal to ThemeMac. - static NSView* ensuredView(ScrollView*); - static void setFocusRingClipRect(const FloatRect&); -}; - -} // namespace WebCore - -#endif // ThemeMac_h diff --git a/chromium/third_party/WebKit/Source/core/platform/mac/ThemeMac.mm b/chromium/third_party/WebKit/Source/core/platform/mac/ThemeMac.mm deleted file mode 100644 index e24ee65a2ae..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/mac/ThemeMac.mm +++ /dev/null @@ -1,728 +0,0 @@ -/* - * Copyright (C) 2008, 2010, 2011, 2012 Apple Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "config.h" -#import "core/platform/mac/ThemeMac.h" - -#import <Carbon/Carbon.h> -#import "platform/graphics/GraphicsContextStateSaver.h" -#import "platform/mac/BlockExceptions.h" -#import "platform/mac/LocalCurrentGraphicsContext.h" -#import "platform/mac/WebCoreNSCellExtras.h" -#import "platform/scroll/ScrollView.h" -#include "wtf/StdLibExtras.h" - -using namespace std; - -NSRect focusRingClipRect; - -// This is a view whose sole purpose is to tell AppKit that it's flipped. -@interface WebCoreFlippedView : NSControl -@end - -@implementation WebCoreFlippedView - -- (BOOL)isFlipped -{ - return YES; -} - -- (NSText *)currentEditor -{ - return nil; -} - -- (BOOL)_automaticFocusRingDisabled -{ - return YES; -} - -- (NSRect)_focusRingVisibleRect -{ - if (NSIsEmptyRect(focusRingClipRect)) - return [self visibleRect]; - - NSRect rect = focusRingClipRect; - rect.origin.y = [self bounds].size.height - NSMaxY(rect); - - return rect; -} - -- (NSView *)_focusRingClipAncestor -{ - return self; -} - -@end - -@implementation NSFont (WebCoreTheme) - -- (NSString*)webCoreFamilyName -{ - if ([[self familyName] hasPrefix:@"."]) - return [self fontName]; - - return [self familyName]; -} - -@end - -namespace WebCore { - -enum { - topMargin, - rightMargin, - bottomMargin, - leftMargin -}; - -Theme* platformTheme() -{ - DEFINE_STATIC_LOCAL(ThemeMac, themeMac, ()); - return &themeMac; -} - -// Helper functions used by a bunch of different control parts. - -static NSControlSize controlSizeForFont(const FontDescription& fontDescription) -{ - int fontSize = fontDescription.computedPixelSize(); - if (fontSize >= 16) - return NSRegularControlSize; - if (fontSize >= 11) - return NSSmallControlSize; - return NSMiniControlSize; -} - -static LengthSize sizeFromNSControlSize(NSControlSize nsControlSize, const LengthSize& zoomedSize, float zoomFactor, const IntSize* sizes) -{ - IntSize controlSize = sizes[nsControlSize]; - if (zoomFactor != 1.0f) - controlSize = IntSize(controlSize.width() * zoomFactor, controlSize.height() * zoomFactor); - LengthSize result = zoomedSize; - if (zoomedSize.width().isIntrinsicOrAuto() && controlSize.width() > 0) - result.setWidth(Length(controlSize.width(), Fixed)); - if (zoomedSize.height().isIntrinsicOrAuto() && controlSize.height() > 0) - result.setHeight(Length(controlSize.height(), Fixed)); - return result; -} - -static LengthSize sizeFromFont(const FontDescription& fontDescription, const LengthSize& zoomedSize, float zoomFactor, const IntSize* sizes) -{ - return sizeFromNSControlSize(controlSizeForFont(fontDescription), zoomedSize, zoomFactor, sizes); -} - -static ControlSize controlSizeFromPixelSize(const IntSize* sizes, const IntSize& minZoomedSize, float zoomFactor) -{ - if (minZoomedSize.width() >= static_cast<int>(sizes[NSRegularControlSize].width() * zoomFactor) && - minZoomedSize.height() >= static_cast<int>(sizes[NSRegularControlSize].height() * zoomFactor)) - return NSRegularControlSize; - if (minZoomedSize.width() >= static_cast<int>(sizes[NSSmallControlSize].width() * zoomFactor) && - minZoomedSize.height() >= static_cast<int>(sizes[NSSmallControlSize].height() * zoomFactor)) - return NSSmallControlSize; - return NSMiniControlSize; -} - -static void setControlSize(NSCell* cell, const IntSize* sizes, const IntSize& minZoomedSize, float zoomFactor) -{ - ControlSize size = controlSizeFromPixelSize(sizes, minZoomedSize, zoomFactor); - if (size != [cell controlSize]) // Only update if we have to, since AppKit does work even if the size is the same. - [cell setControlSize:(NSControlSize)size]; -} - -static void updateStates(NSCell* cell, ControlStates states) -{ - // Hover state is not supported by Aqua. - - // Pressed state - bool oldPressed = [cell isHighlighted]; - bool pressed = states & PressedState; - if (pressed != oldPressed) - [cell setHighlighted:pressed]; - - // Enabled state - bool oldEnabled = [cell isEnabled]; - bool enabled = states & EnabledState; - if (enabled != oldEnabled) - [cell setEnabled:enabled]; - -#if BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING - // Focused state - bool oldFocused = [cell showsFirstResponder]; - bool focused = states & FocusState; - if (focused != oldFocused) - [cell setShowsFirstResponder:focused]; -#endif - - // Checked and Indeterminate - bool oldIndeterminate = [cell state] == NSMixedState; - bool indeterminate = (states & IndeterminateState); - bool checked = states & CheckedState; - bool oldChecked = [cell state] == NSOnState; - if (oldIndeterminate != indeterminate || checked != oldChecked) - [cell setState:indeterminate ? NSMixedState : (checked ? NSOnState : NSOffState)]; - - // Window inactive state does not need to be checked explicitly, since we paint parented to - // a view in a window whose key state can be detected. -} - -static ThemeDrawState convertControlStatesToThemeDrawState(ThemeButtonKind kind, ControlStates states) -{ - if (states & ReadOnlyState) - return kThemeStateUnavailableInactive; - if (!(states & EnabledState)) - return kThemeStateUnavailableInactive; - - // Do not process PressedState if !EnabledState or ReadOnlyState. - if (states & PressedState) { - if (kind == kThemeIncDecButton || kind == kThemeIncDecButtonSmall || kind == kThemeIncDecButtonMini) - return states & SpinUpState ? kThemeStatePressedUp : kThemeStatePressedDown; - return kThemeStatePressed; - } - return kThemeStateActive; -} - -static IntRect inflateRect(const IntRect& zoomedRect, const IntSize& zoomedSize, const int* margins, float zoomFactor) -{ - // Only do the inflation if the available width/height are too small. Otherwise try to - // fit the glow/check space into the available box's width/height. - int widthDelta = zoomedRect.width() - (zoomedSize.width() + margins[leftMargin] * zoomFactor + margins[rightMargin] * zoomFactor); - int heightDelta = zoomedRect.height() - (zoomedSize.height() + margins[topMargin] * zoomFactor + margins[bottomMargin] * zoomFactor); - IntRect result(zoomedRect); - if (widthDelta < 0) { - result.setX(result.x() - margins[leftMargin] * zoomFactor); - result.setWidth(result.width() - widthDelta); - } - if (heightDelta < 0) { - result.setY(result.y() - margins[topMargin] * zoomFactor); - result.setHeight(result.height() - heightDelta); - } - return result; -} - -// Checkboxes - -static const IntSize* checkboxSizes() -{ - static const IntSize sizes[3] = { IntSize(14, 14), IntSize(12, 12), IntSize(10, 10) }; - return sizes; -} - -static const int* checkboxMargins(NSControlSize controlSize) -{ - static const int margins[3][4] = - { - { 3, 4, 4, 2 }, - { 4, 3, 3, 3 }, - { 4, 3, 3, 3 }, - }; - return margins[controlSize]; -} - -static LengthSize checkboxSize(const FontDescription& fontDescription, const LengthSize& zoomedSize, float zoomFactor) -{ - // If the width and height are both specified, then we have nothing to do. - if (!zoomedSize.width().isIntrinsicOrAuto() && !zoomedSize.height().isIntrinsicOrAuto()) - return zoomedSize; - - // Use the font size to determine the intrinsic width of the control. - return sizeFromFont(fontDescription, zoomedSize, zoomFactor, checkboxSizes()); -} - -static NSButtonCell *checkbox(ControlStates states, const IntRect& zoomedRect, float zoomFactor) -{ - static NSButtonCell *checkboxCell; - if (!checkboxCell) { - checkboxCell = [[NSButtonCell alloc] init]; - [checkboxCell setButtonType:NSSwitchButton]; - [checkboxCell setTitle:nil]; - [checkboxCell setAllowsMixedState:YES]; - [checkboxCell setFocusRingType:NSFocusRingTypeExterior]; - } - - // Set the control size based off the rectangle we're painting into. - setControlSize(checkboxCell, checkboxSizes(), zoomedRect.size(), zoomFactor); - - // Update the various states we respond to. - updateStates(checkboxCell, states); - - return checkboxCell; -} - -// FIXME: Share more code with radio buttons. -static void paintCheckbox(ControlStates states, GraphicsContext* context, const IntRect& zoomedRect, float zoomFactor, ScrollView* scrollView) -{ - BEGIN_BLOCK_OBJC_EXCEPTIONS - - // Determine the width and height needed for the control and prepare the cell for painting. - NSButtonCell *checkboxCell = checkbox(states, zoomedRect, zoomFactor); - GraphicsContextStateSaver stateSaver(*context); - - NSControlSize controlSize = [checkboxCell controlSize]; - IntSize zoomedSize = checkboxSizes()[controlSize]; - zoomedSize.setWidth(zoomedSize.width() * zoomFactor); - zoomedSize.setHeight(zoomedSize.height() * zoomFactor); - IntRect inflatedRect = inflateRect(zoomedRect, zoomedSize, checkboxMargins(controlSize), zoomFactor); - - if (zoomFactor != 1.0f) { - inflatedRect.setWidth(inflatedRect.width() / zoomFactor); - inflatedRect.setHeight(inflatedRect.height() / zoomFactor); - context->translate(inflatedRect.x(), inflatedRect.y()); - context->scale(FloatSize(zoomFactor, zoomFactor)); - context->translate(-inflatedRect.x(), -inflatedRect.y()); - } - - LocalCurrentGraphicsContext localContext(context); - NSView *view = ThemeMac::ensuredView(scrollView); - [checkboxCell drawWithFrame:NSRect(inflatedRect) inView:view]; -#if !BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING - if (states & FocusState) - [checkboxCell _web_drawFocusRingWithFrame:NSRect(inflatedRect) inView:view]; -#endif - [checkboxCell setControlView:nil]; - - END_BLOCK_OBJC_EXCEPTIONS -} - -// Radio Buttons - -static const IntSize* radioSizes() -{ - static const IntSize sizes[3] = { IntSize(14, 15), IntSize(12, 13), IntSize(10, 10) }; - return sizes; -} - -static const int* radioMargins(NSControlSize controlSize) -{ - static const int margins[3][4] = - { - { 2, 2, 4, 2 }, - { 3, 2, 3, 2 }, - { 1, 0, 2, 0 }, - }; - return margins[controlSize]; -} - -static LengthSize radioSize(const FontDescription& fontDescription, const LengthSize& zoomedSize, float zoomFactor) -{ - // If the width and height are both specified, then we have nothing to do. - if (!zoomedSize.width().isIntrinsicOrAuto() && !zoomedSize.height().isIntrinsicOrAuto()) - return zoomedSize; - - // Use the font size to determine the intrinsic width of the control. - return sizeFromFont(fontDescription, zoomedSize, zoomFactor, radioSizes()); -} - -static NSButtonCell *radio(ControlStates states, const IntRect& zoomedRect, float zoomFactor) -{ - static NSButtonCell *radioCell; - if (!radioCell) { - radioCell = [[NSButtonCell alloc] init]; - [radioCell setButtonType:NSRadioButton]; - [radioCell setTitle:nil]; - [radioCell setFocusRingType:NSFocusRingTypeExterior]; - } - - // Set the control size based off the rectangle we're painting into. - setControlSize(radioCell, radioSizes(), zoomedRect.size(), zoomFactor); - - // Update the various states we respond to. - updateStates(radioCell, states); - - return radioCell; -} - -static void paintRadio(ControlStates states, GraphicsContext* context, const IntRect& zoomedRect, float zoomFactor, ScrollView* scrollView) -{ - // Determine the width and height needed for the control and prepare the cell for painting. - NSButtonCell *radioCell = radio(states, zoomedRect, zoomFactor); - GraphicsContextStateSaver stateSaver(*context); - - NSControlSize controlSize = [radioCell controlSize]; - IntSize zoomedSize = radioSizes()[controlSize]; - zoomedSize.setWidth(zoomedSize.width() * zoomFactor); - zoomedSize.setHeight(zoomedSize.height() * zoomFactor); - IntRect inflatedRect = inflateRect(zoomedRect, zoomedSize, radioMargins(controlSize), zoomFactor); - - if (zoomFactor != 1.0f) { - inflatedRect.setWidth(inflatedRect.width() / zoomFactor); - inflatedRect.setHeight(inflatedRect.height() / zoomFactor); - context->translate(inflatedRect.x(), inflatedRect.y()); - context->scale(FloatSize(zoomFactor, zoomFactor)); - context->translate(-inflatedRect.x(), -inflatedRect.y()); - } - - LocalCurrentGraphicsContext localContext(context); - BEGIN_BLOCK_OBJC_EXCEPTIONS - NSView *view = ThemeMac::ensuredView(scrollView); - [radioCell drawWithFrame:NSRect(inflatedRect) inView:view]; -#if !BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING - if (states & FocusState) - [radioCell _web_drawFocusRingWithFrame:NSRect(inflatedRect) inView:view]; -#endif - [radioCell setControlView:nil]; - END_BLOCK_OBJC_EXCEPTIONS -} - -// Buttons - -// Buttons really only constrain height. They respect width. -static const IntSize* buttonSizes() -{ - static const IntSize sizes[3] = { IntSize(0, 21), IntSize(0, 18), IntSize(0, 15) }; - return sizes; -} - -static const int* buttonMargins(NSControlSize controlSize) -{ - static const int margins[3][4] = - { - { 4, 6, 7, 6 }, - { 4, 5, 6, 5 }, - { 0, 1, 1, 1 }, - }; - return margins[controlSize]; -} - -static void setUpButtonCell(NSButtonCell *cell, ControlPart part, ControlStates states, const IntRect& zoomedRect, float zoomFactor) -{ - // Set the control size based off the rectangle we're painting into. - const IntSize* sizes = buttonSizes(); - if (part == SquareButtonPart || zoomedRect.height() > buttonSizes()[NSRegularControlSize].height() * zoomFactor) { - // Use the square button - if ([cell bezelStyle] != NSShadowlessSquareBezelStyle) - [cell setBezelStyle:NSShadowlessSquareBezelStyle]; - } else if ([cell bezelStyle] != NSRoundedBezelStyle) - [cell setBezelStyle:NSRoundedBezelStyle]; - - setControlSize(cell, sizes, zoomedRect.size(), zoomFactor); - - // Update the various states we respond to. - updateStates(cell, states); -} - -static NSButtonCell *button(ControlPart part, ControlStates states, const IntRect& zoomedRect, float zoomFactor) -{ - static NSButtonCell *cell = nil; - if (!cell) { - cell = [[NSButtonCell alloc] init]; - [cell setTitle:nil]; - [cell setButtonType:NSMomentaryPushInButton]; - } - setUpButtonCell(cell, part, states, zoomedRect, zoomFactor); - return cell; -} - -static void paintButton(ControlPart part, ControlStates states, GraphicsContext* context, const IntRect& zoomedRect, float zoomFactor, ScrollView* scrollView) -{ - BEGIN_BLOCK_OBJC_EXCEPTIONS - - // Determine the width and height needed for the control and prepare the cell for painting. - NSButtonCell *buttonCell = button(part, states, zoomedRect, zoomFactor); - GraphicsContextStateSaver stateSaver(*context); - - NSControlSize controlSize = [buttonCell controlSize]; - IntSize zoomedSize = buttonSizes()[controlSize]; - zoomedSize.setWidth(zoomedRect.width()); // Buttons don't ever constrain width, so the zoomed width can just be honored. - zoomedSize.setHeight(zoomedSize.height() * zoomFactor); - IntRect inflatedRect = zoomedRect; - if ([buttonCell bezelStyle] == NSRoundedBezelStyle) { - // Center the button within the available space. - if (inflatedRect.height() > zoomedSize.height()) { - inflatedRect.setY(inflatedRect.y() + (inflatedRect.height() - zoomedSize.height()) / 2); - inflatedRect.setHeight(zoomedSize.height()); - } - - // Now inflate it to account for the shadow. - inflatedRect = inflateRect(inflatedRect, zoomedSize, buttonMargins(controlSize), zoomFactor); - - if (zoomFactor != 1.0f) { - inflatedRect.setWidth(inflatedRect.width() / zoomFactor); - inflatedRect.setHeight(inflatedRect.height() / zoomFactor); - context->translate(inflatedRect.x(), inflatedRect.y()); - context->scale(FloatSize(zoomFactor, zoomFactor)); - context->translate(-inflatedRect.x(), -inflatedRect.y()); - } - } - - LocalCurrentGraphicsContext localContext(context); - NSView *view = ThemeMac::ensuredView(scrollView); - - [buttonCell drawWithFrame:NSRect(inflatedRect) inView:view]; -#if !BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING - if (states & FocusState) - [buttonCell _web_drawFocusRingWithFrame:NSRect(inflatedRect) inView:view]; -#endif - [buttonCell setControlView:nil]; - - END_BLOCK_OBJC_EXCEPTIONS -} - -// Stepper - -static const IntSize* stepperSizes() -{ - static const IntSize sizes[3] = { IntSize(19, 27), IntSize(15, 22), IntSize(13, 15) }; - return sizes; -} - -// We don't use controlSizeForFont() for steppers because the stepper height -// should be equal to or less than the corresponding text field height, -static NSControlSize stepperControlSizeForFont(const FontDescription& fontDescription) -{ - int fontSize = fontDescription.computedPixelSize(); - if (fontSize >= 18) - return NSRegularControlSize; - if (fontSize >= 13) - return NSSmallControlSize; - return NSMiniControlSize; -} - -static void paintStepper(ControlStates states, GraphicsContext* context, const IntRect& zoomedRect, float zoomFactor, ScrollView*) -{ - // We don't use NSStepperCell because there are no ways to draw an - // NSStepperCell with the up button highlighted. - - HIThemeButtonDrawInfo drawInfo; - drawInfo.version = 0; - drawInfo.state = convertControlStatesToThemeDrawState(kThemeIncDecButton, states); - drawInfo.adornment = kThemeAdornmentDefault; - ControlSize controlSize = controlSizeFromPixelSize(stepperSizes(), zoomedRect.size(), zoomFactor); - if (controlSize == NSSmallControlSize) - drawInfo.kind = kThemeIncDecButtonSmall; - else if (controlSize == NSMiniControlSize) - drawInfo.kind = kThemeIncDecButtonMini; - else - drawInfo.kind = kThemeIncDecButton; - - IntRect rect(zoomedRect); - GraphicsContextStateSaver stateSaver(*context); - if (zoomFactor != 1.0f) { - rect.setWidth(rect.width() / zoomFactor); - rect.setHeight(rect.height() / zoomFactor); - context->translate(rect.x(), rect.y()); - context->scale(FloatSize(zoomFactor, zoomFactor)); - context->translate(-rect.x(), -rect.y()); - } - CGRect bounds(rect); - CGRect backgroundBounds; - HIThemeGetButtonBackgroundBounds(&bounds, &drawInfo, &backgroundBounds); - // Center the stepper rectangle in the specified area. - backgroundBounds.origin.x = bounds.origin.x + (bounds.size.width - backgroundBounds.size.width) / 2; - if (backgroundBounds.size.height < bounds.size.height) { - int heightDiff = clampToInteger(bounds.size.height - backgroundBounds.size.height); - backgroundBounds.origin.y = bounds.origin.y + (heightDiff / 2) + 1; - } - - LocalCurrentGraphicsContext localContext(context); - HIThemeDrawButton(&backgroundBounds, &drawInfo, localContext.cgContext(), kHIThemeOrientationNormal, 0); -} - -// This will ensure that we always return a valid NSView, even if ScrollView doesn't have an associated document NSView. -// If the ScrollView doesn't have an NSView, we will return a fake NSView whose sole purpose is to tell AppKit that it's flipped. -NSView *ThemeMac::ensuredView(ScrollView* scrollView) -{ - - // Use a fake flipped view. - static NSView *flippedView = [[WebCoreFlippedView alloc] init]; - [flippedView setFrameSize:NSSizeFromCGSize(scrollView->contentsSize())]; - - return flippedView; -} - -void ThemeMac::setFocusRingClipRect(const FloatRect& rect) -{ - focusRingClipRect = rect; -} - -// Theme overrides - -int ThemeMac::baselinePositionAdjustment(ControlPart part) const -{ - if (part == CheckboxPart || part == RadioPart) - return -2; - return Theme::baselinePositionAdjustment(part); -} - -FontDescription ThemeMac::controlFont(ControlPart part, const FontDescription& fontDescription, float zoomFactor) const -{ - switch (part) { - case PushButtonPart: { - FontDescription result; - result.setIsAbsoluteSize(true); - result.setGenericFamily(FontDescription::SerifFamily); - - NSFont* nsFont = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:controlSizeForFont(fontDescription)]]; - result.firstFamily().setFamily([nsFont webCoreFamilyName]); - result.setComputedSize([nsFont pointSize] * zoomFactor); - result.setSpecifiedSize([nsFont pointSize] * zoomFactor); - return result; - } - default: - return Theme::controlFont(part, fontDescription, zoomFactor); - } -} - -LengthSize ThemeMac::controlSize(ControlPart part, const FontDescription& fontDescription, const LengthSize& zoomedSize, float zoomFactor) const -{ - switch (part) { - case CheckboxPart: - return checkboxSize(fontDescription, zoomedSize, zoomFactor); - case RadioPart: - return radioSize(fontDescription, zoomedSize, zoomFactor); - case PushButtonPart: - // Height is reset to auto so that specified heights can be ignored. - return sizeFromFont(fontDescription, LengthSize(zoomedSize.width(), Length()), zoomFactor, buttonSizes()); - case InnerSpinButtonPart: - if (!zoomedSize.width().isIntrinsicOrAuto() && !zoomedSize.height().isIntrinsicOrAuto()) - return zoomedSize; - return sizeFromNSControlSize(stepperControlSizeForFont(fontDescription), zoomedSize, zoomFactor, stepperSizes()); - default: - return zoomedSize; - } -} - -LengthSize ThemeMac::minimumControlSize(ControlPart part, const FontDescription& fontDescription, float zoomFactor) const -{ - switch (part) { - case SquareButtonPart: - case ButtonPart: - return LengthSize(Length(0, Fixed), Length(static_cast<int>(15 * zoomFactor), Fixed)); - case InnerSpinButtonPart:{ - IntSize base = stepperSizes()[NSMiniControlSize]; - return LengthSize(Length(static_cast<int>(base.width() * zoomFactor), Fixed), - Length(static_cast<int>(base.height() * zoomFactor), Fixed)); - } - default: - return Theme::minimumControlSize(part, fontDescription, zoomFactor); - } -} - -LengthBox ThemeMac::controlBorder(ControlPart part, const FontDescription& fontDescription, const LengthBox& zoomedBox, float zoomFactor) const -{ - switch (part) { - case SquareButtonPart: - case ButtonPart: - return LengthBox(0, zoomedBox.right().value(), 0, zoomedBox.left().value()); - default: - return Theme::controlBorder(part, fontDescription, zoomedBox, zoomFactor); - } -} - -LengthBox ThemeMac::controlPadding(ControlPart part, const FontDescription& fontDescription, const LengthBox& zoomedBox, float zoomFactor) const -{ - switch (part) { - case PushButtonPart: { - // Just use 8px. AppKit wants to use 11px for mini buttons, but that padding is just too large - // for real-world Web sites (creating a huge necessary minimum width for buttons whose space is - // by definition constrained, since we select mini only for small cramped environments. - // This also guarantees the HTML <button> will match our rendering by default, since we're using a consistent - // padding. - const int padding = 8 * zoomFactor; - return LengthBox(0, padding, 0, padding); - } - default: - return Theme::controlPadding(part, fontDescription, zoomedBox, zoomFactor); - } -} - -void ThemeMac::inflateControlPaintRect(ControlPart part, ControlStates states, IntRect& zoomedRect, float zoomFactor) const -{ - BEGIN_BLOCK_OBJC_EXCEPTIONS - switch (part) { - case CheckboxPart: { - // We inflate the rect as needed to account for padding included in the cell to accommodate the checkbox - // shadow" and the check. We don't consider this part of the bounds of the control in WebKit. - NSCell *cell = checkbox(states, zoomedRect, zoomFactor); - NSControlSize controlSize = [cell controlSize]; - IntSize zoomedSize = checkboxSizes()[controlSize]; - zoomedSize.setHeight(zoomedSize.height() * zoomFactor); - zoomedSize.setWidth(zoomedSize.width() * zoomFactor); - zoomedRect = inflateRect(zoomedRect, zoomedSize, checkboxMargins(controlSize), zoomFactor); - break; - } - case RadioPart: { - // We inflate the rect as needed to account for padding included in the cell to accommodate the radio button - // shadow". We don't consider this part of the bounds of the control in WebKit. - NSCell *cell = radio(states, zoomedRect, zoomFactor); - NSControlSize controlSize = [cell controlSize]; - IntSize zoomedSize = radioSizes()[controlSize]; - zoomedSize.setHeight(zoomedSize.height() * zoomFactor); - zoomedSize.setWidth(zoomedSize.width() * zoomFactor); - zoomedRect = inflateRect(zoomedRect, zoomedSize, radioMargins(controlSize), zoomFactor); - break; - } - case PushButtonPart: - case ButtonPart: { - NSButtonCell *cell = button(part, states, zoomedRect, zoomFactor); - NSControlSize controlSize = [cell controlSize]; - - // We inflate the rect as needed to account for the Aqua button's shadow. - if ([cell bezelStyle] == NSRoundedBezelStyle) { - IntSize zoomedSize = buttonSizes()[controlSize]; - zoomedSize.setHeight(zoomedSize.height() * zoomFactor); - zoomedSize.setWidth(zoomedRect.width()); // Buttons don't ever constrain width, so the zoomed width can just be honored. - zoomedRect = inflateRect(zoomedRect, zoomedSize, buttonMargins(controlSize), zoomFactor); - } - break; - } - case InnerSpinButtonPart: { - static const int stepperMargin[4] = { 0, 0, 0, 0 }; - ControlSize controlSize = controlSizeFromPixelSize(stepperSizes(), zoomedRect.size(), zoomFactor); - IntSize zoomedSize = stepperSizes()[controlSize]; - zoomedSize.setHeight(zoomedSize.height() * zoomFactor); - zoomedSize.setWidth(zoomedSize.width() * zoomFactor); - zoomedRect = inflateRect(zoomedRect, zoomedSize, stepperMargin, zoomFactor); - break; - } - default: - break; - } - END_BLOCK_OBJC_EXCEPTIONS -} - -void ThemeMac::paint(ControlPart part, ControlStates states, GraphicsContext* context, const IntRect& zoomedRect, float zoomFactor, ScrollView* scrollView) const -{ - switch (part) { - case CheckboxPart: - paintCheckbox(states, context, zoomedRect, zoomFactor, scrollView); - break; - case RadioPart: - paintRadio(states, context, zoomedRect, zoomFactor, scrollView); - break; - case PushButtonPart: - case ButtonPart: - case SquareButtonPart: - paintButton(part, states, context, zoomedRect, zoomFactor, scrollView); - break; - case InnerSpinButtonPart: - paintStepper(states, context, zoomedRect, zoomFactor, scrollView); - break; - default: - break; - } -} - -} diff --git a/chromium/third_party/WebKit/Source/core/platform/mediastream/MediaStreamCenter.cpp b/chromium/third_party/WebKit/Source/core/platform/mediastream/MediaStreamCenter.cpp deleted file mode 100644 index 3baadb439b6..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/mediastream/MediaStreamCenter.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (C) 2011 Ericsson AB. All rights reserved. - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Ericsson nor the names of its contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#include "core/platform/mediastream/MediaStreamCenter.h" - -#include "core/platform/mediastream/MediaStreamDescriptor.h" -#include "modules/mediastream/MediaStreamTrackSourcesRequest.h" -#include "public/platform/Platform.h" -#include "public/platform/WebMediaStream.h" -#include "public/platform/WebMediaStreamCenter.h" -#include "public/platform/WebMediaStreamTrack.h" -#include "public/platform/WebMediaStreamTrackSourcesRequest.h" -#include "wtf/MainThread.h" -#include "wtf/PassOwnPtr.h" - -namespace WebCore { - -MediaStreamCenter& MediaStreamCenter::instance() -{ - ASSERT(isMainThread()); - DEFINE_STATIC_LOCAL(MediaStreamCenter, center, ()); - return center; -} - -MediaStreamCenter::MediaStreamCenter() - : m_private(adoptPtr(blink::Platform::current()->createMediaStreamCenter(this))) -{ -} - -MediaStreamCenter::~MediaStreamCenter() -{ -} - -bool MediaStreamCenter::getMediaStreamTrackSources(PassRefPtr<MediaStreamTrackSourcesRequest> request) -{ - return m_private && m_private->getMediaStreamTrackSources(request); -} - -void MediaStreamCenter::didSetMediaStreamTrackEnabled(MediaStreamDescriptor* stream, MediaStreamComponent* component) -{ - if (m_private) { - if (component->enabled()) { - m_private->didEnableMediaStreamTrack(stream, component); - m_private->didEnableMediaStreamTrack(component); - } else { - m_private->didDisableMediaStreamTrack(stream, component); - m_private->didDisableMediaStreamTrack(component); - } - } -} - -bool MediaStreamCenter::didAddMediaStreamTrack(MediaStreamDescriptor* stream, MediaStreamComponent* component) -{ - return m_private && m_private->didAddMediaStreamTrack(stream, component); -} - -bool MediaStreamCenter::didRemoveMediaStreamTrack(MediaStreamDescriptor* stream, MediaStreamComponent* component) -{ - return m_private && m_private->didRemoveMediaStreamTrack(stream, component); -} - -void MediaStreamCenter::didStopLocalMediaStream(MediaStreamDescriptor* stream) -{ - if (m_private) - m_private->didStopLocalMediaStream(stream); -} - -bool MediaStreamCenter::didStopMediaStreamTrack(MediaStreamComponent* track) -{ - return m_private && m_private->didStopMediaStreamTrack(track); -} - -void MediaStreamCenter::didCreateMediaStream(MediaStreamDescriptor* stream) -{ - if (m_private) { - blink::WebMediaStream webStream(stream); - m_private->didCreateMediaStream(webStream); - } -} - -void MediaStreamCenter::didCreateMediaStreamTrack(MediaStreamComponent* track) -{ - if (m_private) - m_private->didCreateMediaStreamTrack(track); -} - -void MediaStreamCenter::stopLocalMediaStream(const blink::WebMediaStream& webStream) -{ - MediaStreamDescriptor* stream = webStream; - MediaStreamDescriptorClient* client = stream->client(); - if (client) - client->streamEnded(); - else - stream->setEnded(); -} - -} // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/platform/mediastream/MediaStreamCenter.h b/chromium/third_party/WebKit/Source/core/platform/mediastream/MediaStreamCenter.h deleted file mode 100644 index 7a3630b1adb..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/mediastream/MediaStreamCenter.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2011 Ericsson AB. All rights reserved. - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Ericsson nor the names of its contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef MediaStreamCenter_h -#define MediaStreamCenter_h - -#include "public/platform/WebMediaStreamCenterClient.h" -#include "public/platform/WebVector.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassRefPtr.h" -#include "wtf/text/WTFString.h" - -namespace blink { -class WebMediaStream; -class WebMediaStreamCenter; -class WebMediaStreamTrack; -} - -namespace WebCore { - -class MediaStreamComponent; -class MediaStreamDescriptor; -class MediaStreamTrackSourcesRequest; - -class MediaStreamCenter : public blink::WebMediaStreamCenterClient { -public: - ~MediaStreamCenter(); - - static MediaStreamCenter& instance(); - - bool getMediaStreamTrackSources(PassRefPtr<MediaStreamTrackSourcesRequest>); - - void didCreateMediaStreamTrack(MediaStreamComponent*); - void didSetMediaStreamTrackEnabled(MediaStreamDescriptor*, MediaStreamComponent*); - bool didStopMediaStreamTrack(MediaStreamComponent*); - - void didCreateMediaStream(MediaStreamDescriptor*); - bool didAddMediaStreamTrack(MediaStreamDescriptor*, MediaStreamComponent*); - bool didRemoveMediaStreamTrack(MediaStreamDescriptor*, MediaStreamComponent*); - void didStopLocalMediaStream(MediaStreamDescriptor*); - - // blink::WebMediaStreamCenterClient - virtual void stopLocalMediaStream(const blink::WebMediaStream&) OVERRIDE; - -private: - MediaStreamCenter(); - - OwnPtr<blink::WebMediaStreamCenter> m_private; -}; - -} // namespace WebCore - -#endif // MediaStreamCenter_h diff --git a/chromium/third_party/WebKit/Source/core/platform/mediastream/MediaStreamDescriptor.cpp b/chromium/third_party/WebKit/Source/core/platform/mediastream/MediaStreamDescriptor.cpp deleted file mode 100644 index 7ec27a3a3c7..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/mediastream/MediaStreamDescriptor.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (C) 2011 Ericsson AB. All rights reserved. - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#include "core/platform/mediastream/MediaStreamDescriptor.h" - -#include "platform/UUID.h" - -namespace WebCore { - -PassRefPtr<MediaStreamDescriptor> MediaStreamDescriptor::create(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources) -{ - return adoptRef(new MediaStreamDescriptor(createCanonicalUUIDString(), audioSources, videoSources)); -} - -PassRefPtr<MediaStreamDescriptor> MediaStreamDescriptor::create(const String& id, const MediaStreamComponentVector& audioComponents, const MediaStreamComponentVector& videoComponents) -{ - return adoptRef(new MediaStreamDescriptor(id, audioComponents, videoComponents)); -} - -void MediaStreamDescriptor::addComponent(PassRefPtr<MediaStreamComponent> component) -{ - switch (component->source()->type()) { - case MediaStreamSource::TypeAudio: - if (m_audioComponents.find(component) == kNotFound) - m_audioComponents.append(component); - break; - case MediaStreamSource::TypeVideo: - if (m_videoComponents.find(component) == kNotFound) - m_videoComponents.append(component); - break; - } -} - -void MediaStreamDescriptor::removeComponent(PassRefPtr<MediaStreamComponent> component) -{ - size_t pos = kNotFound; - switch (component->source()->type()) { - case MediaStreamSource::TypeAudio: - pos = m_audioComponents.find(component); - if (pos != kNotFound) - m_audioComponents.remove(pos); - break; - case MediaStreamSource::TypeVideo: - pos = m_videoComponents.find(component); - if (pos != kNotFound) - m_videoComponents.remove(pos); - break; - } -} - -void MediaStreamDescriptor::addRemoteTrack(MediaStreamComponent* component) -{ - if (m_client) - m_client->addRemoteTrack(component); - else - addComponent(component); -} - -void MediaStreamDescriptor::removeRemoteTrack(MediaStreamComponent* component) -{ - if (m_client) - m_client->removeRemoteTrack(component); - else - removeComponent(component); -} - -MediaStreamDescriptor::MediaStreamDescriptor(const String& id, const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources) - : m_client(0) - , m_id(id) - , m_ended(false) -{ - ASSERT(m_id.length()); - for (size_t i = 0; i < audioSources.size(); i++) - m_audioComponents.append(MediaStreamComponent::create(this, audioSources[i])); - - for (size_t i = 0; i < videoSources.size(); i++) - m_videoComponents.append(MediaStreamComponent::create(this, videoSources[i])); -} - -MediaStreamDescriptor::MediaStreamDescriptor(const String& id, const MediaStreamComponentVector& audioComponents, const MediaStreamComponentVector& videoComponents) - : m_client(0) - , m_id(id) - , m_ended(false) -{ - ASSERT(m_id.length()); - for (MediaStreamComponentVector::const_iterator iter = audioComponents.begin(); iter != audioComponents.end(); ++iter) { - (*iter)->setStream(this); - m_audioComponents.append((*iter)); - } - for (MediaStreamComponentVector::const_iterator iter = videoComponents.begin(); iter != videoComponents.end(); ++iter) { - (*iter)->setStream(this); - m_videoComponents.append((*iter)); - } -} - -MediaStreamDescriptor::~MediaStreamDescriptor() -{ - for (MediaStreamComponentVector::iterator iter = m_audioComponents.begin(); iter != m_audioComponents.end(); ++iter) - (*iter)->setStream(0); - - for (MediaStreamComponentVector::iterator iter = m_videoComponents.begin(); iter != m_videoComponents.end(); ++iter) - (*iter)->setStream(0); -} - -} // namespace WebCore - diff --git a/chromium/third_party/WebKit/Source/core/platform/mediastream/MediaStreamDescriptor.h b/chromium/third_party/WebKit/Source/core/platform/mediastream/MediaStreamDescriptor.h deleted file mode 100644 index 383602b1f18..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/mediastream/MediaStreamDescriptor.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2011 Ericsson AB. All rights reserved. - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Ericsson nor the names of its contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef MediaStreamDescriptor_h -#define MediaStreamDescriptor_h - -#include "platform/mediastream/MediaStreamComponent.h" -#include "platform/mediastream/MediaStreamSource.h" -#include "wtf/RefCounted.h" -#include "wtf/Vector.h" - -namespace WebCore { - -class MediaStreamDescriptorClient { -public: - virtual ~MediaStreamDescriptorClient() { } - - virtual void trackEnded() = 0; - virtual void streamEnded() = 0; - virtual void addRemoteTrack(MediaStreamComponent*) = 0; - virtual void removeRemoteTrack(MediaStreamComponent*) = 0; -}; - -class MediaStreamDescriptor FINAL : public RefCounted<MediaStreamDescriptor> { -public: - class ExtraData : public RefCounted<ExtraData> { - public: - virtual ~ExtraData() { } - }; - - static PassRefPtr<MediaStreamDescriptor> create(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources); - - static PassRefPtr<MediaStreamDescriptor> create(const String& id, const MediaStreamComponentVector& audioComponents, const MediaStreamComponentVector& videoComponents); - - ~MediaStreamDescriptor(); - - MediaStreamDescriptorClient* client() const { return m_client; } - void setClient(MediaStreamDescriptorClient* client) { m_client = client; } - - String id() const { return m_id; } - - unsigned numberOfAudioComponents() const { return m_audioComponents.size(); } - MediaStreamComponent* audioComponent(unsigned index) const { return m_audioComponents[index].get(); } - - unsigned numberOfVideoComponents() const { return m_videoComponents.size(); } - MediaStreamComponent* videoComponent(unsigned index) const { return m_videoComponents[index].get(); } - - void addComponent(PassRefPtr<MediaStreamComponent>); - void removeComponent(PassRefPtr<MediaStreamComponent>); - - void addRemoteTrack(MediaStreamComponent*); - void removeRemoteTrack(MediaStreamComponent*); - - bool ended() const { return m_ended; } - void setEnded() { m_ended = true; } - - PassRefPtr<ExtraData> extraData() const { return m_extraData; } - void setExtraData(PassRefPtr<ExtraData> extraData) { m_extraData = extraData; } - -private: - MediaStreamDescriptor(const String& id, const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources); - MediaStreamDescriptor(const String& id, const MediaStreamComponentVector& audioComponents, const MediaStreamComponentVector& videoComponents); - - MediaStreamDescriptorClient* m_client; - String m_id; - Vector<RefPtr<MediaStreamComponent> > m_audioComponents; - Vector<RefPtr<MediaStreamComponent> > m_videoComponents; - bool m_ended; - - RefPtr<ExtraData> m_extraData; -}; - -typedef Vector<RefPtr<MediaStreamDescriptor> > MediaStreamDescriptorVector; - -} // namespace WebCore - -#endif // MediaStreamDescriptor_h diff --git a/chromium/third_party/WebKit/Source/core/platform/mediastream/RTCDataChannelHandler.cpp b/chromium/third_party/WebKit/Source/core/platform/mediastream/RTCDataChannelHandler.cpp deleted file mode 100644 index 7c91a118140..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/mediastream/RTCDataChannelHandler.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "core/platform/mediastream/RTCDataChannelHandler.h" - -namespace WebCore { - -PassOwnPtr<RTCDataChannelHandler> RTCDataChannelHandler::create(blink::WebRTCDataChannelHandler* webHandler) -{ - return adoptPtr(new RTCDataChannelHandler(webHandler)); -} - -RTCDataChannelHandler::RTCDataChannelHandler(blink::WebRTCDataChannelHandler* webHandler) - : m_webHandler(adoptPtr(webHandler)) - , m_client(0) -{ -} - -RTCDataChannelHandler::~RTCDataChannelHandler() -{ -} - -void RTCDataChannelHandler::setClient(RTCDataChannelHandlerClient* client) -{ - m_client = client; - m_webHandler->setClient(m_client ? this : 0); -} - -String RTCDataChannelHandler::label() const -{ - return m_webHandler->label(); -} - -bool RTCDataChannelHandler::isReliable() const -{ - return m_webHandler->isReliable(); -} - -bool RTCDataChannelHandler::ordered() const -{ - return m_webHandler->ordered(); -} - -unsigned short RTCDataChannelHandler::maxRetransmitTime() const -{ - return m_webHandler->maxRetransmitTime(); -} - -unsigned short RTCDataChannelHandler::maxRetransmits() const -{ - return m_webHandler->maxRetransmits(); -} - -String RTCDataChannelHandler::protocol() const -{ - return m_webHandler->protocol(); -} - -bool RTCDataChannelHandler::negotiated() const -{ - return m_webHandler->negotiated(); -} - -unsigned short RTCDataChannelHandler::id() const -{ - return m_webHandler->id(); -} - -unsigned long RTCDataChannelHandler::bufferedAmount() -{ - return m_webHandler->bufferedAmount(); -} - -bool RTCDataChannelHandler::sendStringData(const String& data) -{ - return m_webHandler->sendStringData(data); -} - -bool RTCDataChannelHandler::sendRawData(const char* data, size_t size) -{ - return m_webHandler->sendRawData(data, size); -} - -void RTCDataChannelHandler::close() -{ - m_webHandler->close(); -} - -void RTCDataChannelHandler::didChangeReadyState(WebRTCDataChannelHandlerClient::ReadyState state) const -{ - if (m_client) - m_client->didChangeReadyState(static_cast<RTCDataChannelHandlerClient::ReadyState>(state)); -} - -void RTCDataChannelHandler::didReceiveStringData(const blink::WebString& data) const -{ - if (m_client) - m_client->didReceiveStringData(data); -} - -void RTCDataChannelHandler::didReceiveRawData(const char* data, size_t size) const -{ - if (m_client) - m_client->didReceiveRawData(data, size); -} - -void RTCDataChannelHandler::didDetectError() const -{ - if (m_client) - m_client->didDetectError(); -} - -} // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/platform/mediastream/RTCDataChannelHandler.h b/chromium/third_party/WebKit/Source/core/platform/mediastream/RTCDataChannelHandler.h deleted file mode 100644 index d860dad83bb..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/mediastream/RTCDataChannelHandler.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef RTCDataChannelHandler_h -#define RTCDataChannelHandler_h - -#include "core/platform/mediastream/RTCDataChannelHandlerClient.h" -#include "public/platform/WebRTCDataChannelHandler.h" -#include "public/platform/WebRTCDataChannelHandlerClient.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" - -namespace WebCore { - -class RTCDataChannelHandlerClient; - -class RTCDataChannelHandler : public blink::WebRTCDataChannelHandlerClient { -public: - static PassOwnPtr<RTCDataChannelHandler> create(blink::WebRTCDataChannelHandler*); - virtual ~RTCDataChannelHandler(); - - void setClient(RTCDataChannelHandlerClient*); - - String label() const; - - // DEPRECATED - bool isReliable() const; - - bool ordered() const; - unsigned short maxRetransmitTime() const; - unsigned short maxRetransmits() const; - String protocol() const; - bool negotiated() const; - unsigned short id() const; - - unsigned long bufferedAmount(); - bool sendStringData(const String&); - bool sendRawData(const char*, size_t); - void close(); - - // blink::WebRTCDataChannelHandlerClient implementation. - virtual void didChangeReadyState(ReadyState) const OVERRIDE; - virtual void didReceiveStringData(const blink::WebString&) const OVERRIDE; - virtual void didReceiveRawData(const char*, size_t) const OVERRIDE; - virtual void didDetectError() const OVERRIDE; - -private: - explicit RTCDataChannelHandler(blink::WebRTCDataChannelHandler*); - - OwnPtr<blink::WebRTCDataChannelHandler> m_webHandler; - RTCDataChannelHandlerClient* m_client; -}; - -} // namespace WebCore - -#endif // RTCDataChannelHandler_h diff --git a/chromium/third_party/WebKit/Source/core/platform/mediastream/RTCDataChannelHandlerClient.h b/chromium/third_party/WebKit/Source/core/platform/mediastream/RTCDataChannelHandlerClient.h deleted file mode 100644 index ceaf13cfedc..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/mediastream/RTCDataChannelHandlerClient.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef RTCDataChannelHandlerClient_h -#define RTCDataChannelHandlerClient_h - -#include "wtf/text/WTFString.h" - -namespace WebCore { - -class RTCDataChannelHandlerClient { -public: - enum ReadyState { - ReadyStateConnecting = 0, - ReadyStateOpen = 1, - ReadyStateClosing = 2, - ReadyStateClosed = 3, - }; - - virtual ~RTCDataChannelHandlerClient() { } - - virtual void didChangeReadyState(ReadyState) = 0; - virtual void didReceiveStringData(const String&) = 0; - virtual void didReceiveRawData(const char*, size_t) = 0; - virtual void didDetectError() = 0; -}; - -} // namespace WebCore - -#endif // RTCDataChannelHandlerClient_h diff --git a/chromium/third_party/WebKit/Source/core/platform/mediastream/RTCPeerConnectionHandler.cpp b/chromium/third_party/WebKit/Source/core/platform/mediastream/RTCPeerConnectionHandler.cpp deleted file mode 100644 index b27cabbe192..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/mediastream/RTCPeerConnectionHandler.cpp +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "core/platform/mediastream/RTCPeerConnectionHandler.h" - -#include "core/platform/mediastream/RTCDataChannelHandler.h" -#include "core/platform/mediastream/RTCPeerConnectionHandlerClient.h" -#include "core/platform/mediastream/RTCStatsRequest.h" -#include "platform/mediastream/MediaConstraints.h" -#include "platform/mediastream/MediaStreamComponent.h" -#include "platform/mediastream/RTCConfiguration.h" -#include "platform/mediastream/RTCDTMFSenderHandler.h" -#include "platform/mediastream/RTCSessionDescriptionRequest.h" -#include "platform/mediastream/RTCVoidRequest.h" -#include "public/platform/Platform.h" -#include "public/platform/WebMediaConstraints.h" -#include "public/platform/WebMediaStream.h" -#include "public/platform/WebMediaStreamTrack.h" -#include "public/platform/WebRTCConfiguration.h" -#include "public/platform/WebRTCDTMFSenderHandler.h" -#include "public/platform/WebRTCDataChannelHandler.h" -#include "public/platform/WebRTCICECandidate.h" -#include "public/platform/WebRTCSessionDescription.h" -#include "public/platform/WebRTCSessionDescriptionRequest.h" -#include "public/platform/WebRTCStatsRequest.h" -#include "public/platform/WebRTCVoidRequest.h" -#include "wtf/PassOwnPtr.h" - -namespace WebCore { - -blink::WebRTCPeerConnectionHandler* RTCPeerConnectionHandler::toWebRTCPeerConnectionHandler(RTCPeerConnectionHandler* handler) -{ - return static_cast<RTCPeerConnectionHandler*>(handler)->m_webHandler.get(); -} - -PassOwnPtr<RTCPeerConnectionHandler> RTCPeerConnectionHandler::create(RTCPeerConnectionHandlerClient* client) -{ - ASSERT(client); - OwnPtr<RTCPeerConnectionHandler> handler = adoptPtr(new RTCPeerConnectionHandler(client)); - - if (!handler->createWebHandler()) - return nullptr; - - return handler.release(); -} - -RTCPeerConnectionHandler::RTCPeerConnectionHandler(RTCPeerConnectionHandlerClient* client) - : m_client(client) -{ -} - -RTCPeerConnectionHandler::~RTCPeerConnectionHandler() -{ -} - -bool RTCPeerConnectionHandler::createWebHandler() -{ - m_webHandler = adoptPtr(blink::Platform::current()->createRTCPeerConnectionHandler(this)); - return m_webHandler; -} - -bool RTCPeerConnectionHandler::initialize(PassRefPtr<RTCConfiguration> configuration, PassRefPtr<MediaConstraints> constraints) -{ - return m_webHandler->initialize(configuration, constraints); -} - -void RTCPeerConnectionHandler::createOffer(PassRefPtr<RTCSessionDescriptionRequest> request, PassRefPtr<MediaConstraints> constraints) -{ - m_webHandler->createOffer(request, constraints); -} - -void RTCPeerConnectionHandler::createAnswer(PassRefPtr<RTCSessionDescriptionRequest> request, PassRefPtr<MediaConstraints> constraints) -{ - m_webHandler->createAnswer(request, constraints); -} - -void RTCPeerConnectionHandler::setLocalDescription(PassRefPtr<RTCVoidRequest> request, blink::WebRTCSessionDescription sessionDescription) -{ - m_webHandler->setLocalDescription(request, sessionDescription); -} - -void RTCPeerConnectionHandler::setRemoteDescription(PassRefPtr<RTCVoidRequest> request, blink::WebRTCSessionDescription sessionDescription) -{ - m_webHandler->setRemoteDescription(request, sessionDescription); -} - -bool RTCPeerConnectionHandler::updateIce(PassRefPtr<RTCConfiguration> configuration, PassRefPtr<MediaConstraints> constraints) -{ - return m_webHandler->updateICE(configuration, constraints); -} - -bool RTCPeerConnectionHandler::addIceCandidate(blink::WebRTCICECandidate iceCandidate) -{ - return m_webHandler->addICECandidate(iceCandidate); -} - -bool RTCPeerConnectionHandler::addIceCandidate(PassRefPtr<RTCVoidRequest> request, blink::WebRTCICECandidate iceCandidate) -{ - return m_webHandler->addICECandidate(request, iceCandidate); -} - -blink::WebRTCSessionDescription RTCPeerConnectionHandler::localDescription() -{ - return m_webHandler->localDescription(); -} - -blink::WebRTCSessionDescription RTCPeerConnectionHandler::remoteDescription() -{ - return m_webHandler->remoteDescription(); -} - -bool RTCPeerConnectionHandler::addStream(PassRefPtr<MediaStreamDescriptor> mediaStream, PassRefPtr<MediaConstraints> constraints) -{ - return m_webHandler->addStream(mediaStream, constraints); -} - -void RTCPeerConnectionHandler::removeStream(PassRefPtr<MediaStreamDescriptor> mediaStream) -{ - m_webHandler->removeStream(mediaStream); -} - -void RTCPeerConnectionHandler::getStats(PassRefPtr<RTCStatsRequest> request) -{ - m_webHandler->getStats(request); -} - -PassOwnPtr<RTCDataChannelHandler> RTCPeerConnectionHandler::createDataChannel(const String& label, const blink::WebRTCDataChannelInit& init) -{ - blink::WebRTCDataChannelHandler* webHandler = m_webHandler->createDataChannel(label, init); - if (!webHandler) - return nullptr; - - return RTCDataChannelHandler::create(webHandler); -} - -PassOwnPtr<RTCDTMFSenderHandler> RTCPeerConnectionHandler::createDTMFSender(PassRefPtr<MediaStreamComponent> track) -{ - blink::WebRTCDTMFSenderHandler* webHandler = m_webHandler->createDTMFSender(track); - if (!webHandler) - return nullptr; - - return RTCDTMFSenderHandler::create(webHandler); -} - -void RTCPeerConnectionHandler::stop() -{ - m_webHandler->stop(); -} - -void RTCPeerConnectionHandler::negotiationNeeded() -{ - m_client->negotiationNeeded(); -} - -void RTCPeerConnectionHandler::didGenerateICECandidate(const blink::WebRTCICECandidate& iceCandidate) -{ - m_client->didGenerateIceCandidate(iceCandidate); -} - -void RTCPeerConnectionHandler::didChangeSignalingState(blink::WebRTCPeerConnectionHandlerClient::SignalingState state) -{ - m_client->didChangeSignalingState(static_cast<RTCPeerConnectionHandlerClient::SignalingState>(state)); -} - -void RTCPeerConnectionHandler::didChangeICEGatheringState(blink::WebRTCPeerConnectionHandlerClient::ICEGatheringState state) -{ - m_client->didChangeIceGatheringState(static_cast<RTCPeerConnectionHandlerClient::IceGatheringState>(state)); -} - -void RTCPeerConnectionHandler::didChangeICEConnectionState(blink::WebRTCPeerConnectionHandlerClient::ICEConnectionState state) -{ - m_client->didChangeIceConnectionState(static_cast<RTCPeerConnectionHandlerClient::IceConnectionState>(state)); -} - -void RTCPeerConnectionHandler::didAddRemoteStream(const blink::WebMediaStream& webMediaStreamDescriptor) -{ - m_client->didAddRemoteStream(webMediaStreamDescriptor); -} - -void RTCPeerConnectionHandler::didRemoveRemoteStream(const blink::WebMediaStream& webMediaStreamDescriptor) -{ - m_client->didRemoveRemoteStream(webMediaStreamDescriptor); -} - -void RTCPeerConnectionHandler::didAddRemoteDataChannel(blink::WebRTCDataChannelHandler* webHandler) -{ - ASSERT(webHandler); - m_client->didAddRemoteDataChannel(RTCDataChannelHandler::create(webHandler)); -} - -} // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/platform/mediastream/RTCPeerConnectionHandler.h b/chromium/third_party/WebKit/Source/core/platform/mediastream/RTCPeerConnectionHandler.h deleted file mode 100644 index 9510a60d297..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/mediastream/RTCPeerConnectionHandler.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Google Inc. nor the names of its contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef RTCPeerConnectionHandler_h -#define RTCPeerConnectionHandler_h - -#include "core/platform/mediastream/MediaStreamDescriptor.h" -#include "public/platform/WebRTCPeerConnectionHandler.h" -#include "public/platform/WebRTCPeerConnectionHandlerClient.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassRefPtr.h" - -namespace blink { -class WebMediaStream; -class WebRTCICECandidate; -class WebRTCSessionDescription; -struct WebRTCDataChannelInit; -} - -namespace WebCore { - -class MediaConstraints; -class MediaStreamComponent; -class RTCConfiguration; -class RTCDTMFSenderHandler; -class RTCDataChannelHandler; -class RTCPeerConnectionHandlerClient; -class RTCSessionDescriptionRequest; -class RTCStatsRequest; -class RTCVoidRequest; - -class RTCPeerConnectionHandler : public blink::WebRTCPeerConnectionHandlerClient { -public: - static PassOwnPtr<RTCPeerConnectionHandler> create(RTCPeerConnectionHandlerClient*); - virtual ~RTCPeerConnectionHandler(); - - bool createWebHandler(); - - bool initialize(PassRefPtr<RTCConfiguration>, PassRefPtr<MediaConstraints>); - - void createOffer(PassRefPtr<RTCSessionDescriptionRequest>, PassRefPtr<MediaConstraints>); - void createAnswer(PassRefPtr<RTCSessionDescriptionRequest>, PassRefPtr<MediaConstraints>); - void setLocalDescription(PassRefPtr<RTCVoidRequest>, blink::WebRTCSessionDescription); - void setRemoteDescription(PassRefPtr<RTCVoidRequest>, blink::WebRTCSessionDescription); - blink::WebRTCSessionDescription localDescription(); - blink::WebRTCSessionDescription remoteDescription(); - bool updateIce(PassRefPtr<RTCConfiguration>, PassRefPtr<MediaConstraints>); - - // DEPRECATED - bool addIceCandidate(blink::WebRTCICECandidate); - - bool addIceCandidate(PassRefPtr<RTCVoidRequest>, blink::WebRTCICECandidate); - bool addStream(PassRefPtr<MediaStreamDescriptor>, PassRefPtr<MediaConstraints>); - void removeStream(PassRefPtr<MediaStreamDescriptor>); - void getStats(PassRefPtr<RTCStatsRequest>); - PassOwnPtr<RTCDataChannelHandler> createDataChannel(const String& label, const blink::WebRTCDataChannelInit&); - PassOwnPtr<RTCDTMFSenderHandler> createDTMFSender(PassRefPtr<MediaStreamComponent>); - void stop(); - - // blink::WebRTCPeerConnectionHandlerClient implementation. - virtual void negotiationNeeded() OVERRIDE; - virtual void didGenerateICECandidate(const blink::WebRTCICECandidate&) OVERRIDE; - virtual void didChangeSignalingState(blink::WebRTCPeerConnectionHandlerClient::SignalingState) OVERRIDE; - virtual void didChangeICEGatheringState(blink::WebRTCPeerConnectionHandlerClient::ICEGatheringState) OVERRIDE; - virtual void didChangeICEConnectionState(blink::WebRTCPeerConnectionHandlerClient::ICEConnectionState) OVERRIDE; - virtual void didAddRemoteStream(const blink::WebMediaStream&) OVERRIDE; - virtual void didRemoveRemoteStream(const blink::WebMediaStream&) OVERRIDE; - virtual void didAddRemoteDataChannel(blink::WebRTCDataChannelHandler*) OVERRIDE; - - static blink::WebRTCPeerConnectionHandler* toWebRTCPeerConnectionHandler(RTCPeerConnectionHandler*); - -private: - explicit RTCPeerConnectionHandler(RTCPeerConnectionHandlerClient*); - - OwnPtr<blink::WebRTCPeerConnectionHandler> m_webHandler; - RTCPeerConnectionHandlerClient* m_client; -}; - -} // namespace WebCore - -#endif // RTCPeerConnectionHandler_h diff --git a/chromium/third_party/WebKit/Source/core/platform/mediastream/RTCPeerConnectionHandlerClient.h b/chromium/third_party/WebKit/Source/core/platform/mediastream/RTCPeerConnectionHandlerClient.h deleted file mode 100644 index 46f276fb3bd..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/mediastream/RTCPeerConnectionHandlerClient.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2012 Google AB. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Google Inc. nor the names of its contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef RTCPeerConnectionHandlerClient_h -#define RTCPeerConnectionHandlerClient_h - -#include "wtf/PassRefPtr.h" - -namespace blink { -class WebRTCICECandidate; -} - -namespace WebCore { - -class MediaStreamDescriptor; -class RTCDataChannelHandler; - -class RTCPeerConnectionHandlerClient { -public: - enum SignalingState { - SignalingStateStable = 1, - SignalingStateHaveLocalOffer = 2, - SignalingStateHaveRemoteOffer = 3, - SignalingStateHaveLocalPrAnswer = 4, - SignalingStateHaveRemotePrAnswer = 5, - SignalingStateClosed = 6, - }; - - enum IceConnectionState { - IceConnectionStateNew = 1, - IceConnectionStateChecking = 2, - IceConnectionStateConnected = 3, - IceConnectionStateCompleted = 4, - IceConnectionStateFailed = 5, - IceConnectionStateDisconnected = 6, - IceConnectionStateClosed = 7 - }; - - enum IceGatheringState { - IceGatheringStateNew = 1, - IceGatheringStateGathering = 2, - IceGatheringStateComplete = 3 - }; - - virtual ~RTCPeerConnectionHandlerClient() { } - - virtual void negotiationNeeded() = 0; - virtual void didGenerateIceCandidate(blink::WebRTCICECandidate) = 0; - virtual void didChangeSignalingState(SignalingState) = 0; - virtual void didChangeIceGatheringState(IceGatheringState) = 0; - virtual void didChangeIceConnectionState(IceConnectionState) = 0; - virtual void didAddRemoteStream(PassRefPtr<MediaStreamDescriptor>) = 0; - virtual void didRemoveRemoteStream(MediaStreamDescriptor*) = 0; - virtual void didAddRemoteDataChannel(PassOwnPtr<RTCDataChannelHandler>) = 0; -}; - -} // namespace WebCore - -#endif // RTCPeerConnectionHandlerClient_h diff --git a/chromium/third_party/WebKit/Source/core/platform/mediastream/RTCStatsRequest.h b/chromium/third_party/WebKit/Source/core/platform/mediastream/RTCStatsRequest.h deleted file mode 100644 index 5f93fe0785a..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/mediastream/RTCStatsRequest.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Google Inc. nor the names of its contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef RTCStatsRequest_h -#define RTCStatsRequest_h - -#include "wtf/PassRefPtr.h" -#include "wtf/RefCounted.h" -#include "wtf/text/WTFString.h" - -namespace WebCore { - -class MediaStreamComponent; -class MediaStreamDescriptor; -class RTCStatsResponseBase; - -class RTCStatsRequest : public RefCounted<RTCStatsRequest> { -public: - virtual ~RTCStatsRequest() { } - - virtual PassRefPtr<RTCStatsResponseBase> createResponse() = 0; - virtual bool hasSelector() = 0; - virtual MediaStreamDescriptor* stream() = 0; - virtual MediaStreamComponent* component() = 0; - virtual void requestSucceeded(PassRefPtr<RTCStatsResponseBase>) = 0; - -protected: - RTCStatsRequest() { } -}; - -} // namespace WebCore - -#endif // RTCStatsRequest_h diff --git a/chromium/third_party/WebKit/Source/core/platform/mock/GeolocationClientMock.cpp b/chromium/third_party/WebKit/Source/core/platform/mock/GeolocationClientMock.cpp deleted file mode 100644 index 8b0be679be4..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/mock/GeolocationClientMock.cpp +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * Copyright (C) 2012 Apple Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "core/platform/mock/GeolocationClientMock.h" - -#include "modules/geolocation/GeolocationController.h" -#include "modules/geolocation/GeolocationError.h" -#include "modules/geolocation/GeolocationPosition.h" - -namespace WebCore { - -GeolocationClientMock::GeolocationClientMock() - : m_controller(0) - , m_hasError(false) - , m_controllerTimer(this, &GeolocationClientMock::controllerTimerFired) - , m_permissionTimer(this, &GeolocationClientMock::permissionTimerFired) - , m_isActive(false) - , m_permissionState(PermissionStateUnset) -{ -} - -GeolocationClientMock::~GeolocationClientMock() -{ - ASSERT(!m_isActive); -} - -void GeolocationClientMock::setController(GeolocationController *controller) -{ - ASSERT(controller && !m_controller); - m_controller = controller; -} - -void GeolocationClientMock::setPosition(PassRefPtr<GeolocationPosition> position) -{ - m_lastPosition = position; - clearError(); - asyncUpdateController(); -} - -void GeolocationClientMock::setPositionUnavailableError(const String& errorMessage) -{ - m_hasError = true; - m_errorMessage = errorMessage; - m_lastPosition = nullptr; - asyncUpdateController(); -} - -void GeolocationClientMock::setPermission(bool allowed) -{ - m_permissionState = allowed ? PermissionStateAllowed : PermissionStateDenied; - asyncUpdatePermission(); -} - -int GeolocationClientMock::numberOfPendingPermissionRequests() const -{ - return m_pendingPermission.size(); -} - -void GeolocationClientMock::requestPermission(Geolocation* geolocation) -{ - m_pendingPermission.add(geolocation); - if (m_permissionState != PermissionStateUnset) - asyncUpdatePermission(); -} - -void GeolocationClientMock::cancelPermissionRequest(Geolocation* geolocation) -{ - // Called from Geolocation::disconnectFrame() in response to Frame destruction. - m_pendingPermission.remove(geolocation); - if (m_pendingPermission.isEmpty() && m_permissionTimer.isActive()) - m_permissionTimer.stop(); -} - -void GeolocationClientMock::asyncUpdatePermission() -{ - ASSERT(m_permissionState != PermissionStateUnset); - if (!m_permissionTimer.isActive()) - m_permissionTimer.startOneShot(0); -} - -void GeolocationClientMock::permissionTimerFired(WebCore::Timer<GeolocationClientMock>* timer) -{ - ASSERT_UNUSED(timer, timer == &m_permissionTimer); - ASSERT(m_permissionState != PermissionStateUnset); - bool allowed = m_permissionState == PermissionStateAllowed; - GeolocationSet::iterator end = m_pendingPermission.end(); - - // Once permission has been set (or denied) on a Geolocation object, there can be - // no further requests for permission to the mock. Consequently the callbacks - // which fire synchronously from Geolocation::setIsAllowed() cannot reentrantly modify - // m_pendingPermission. - for (GeolocationSet::iterator it = m_pendingPermission.begin(); it != end; ++it) - (*it)->setIsAllowed(allowed); - m_pendingPermission.clear(); -} - -void GeolocationClientMock::reset() -{ - m_lastPosition = 0; - clearError(); - m_permissionState = PermissionStateUnset; -} - -void GeolocationClientMock::geolocationDestroyed() -{ - ASSERT(!m_isActive); -} - -void GeolocationClientMock::startUpdating() -{ - ASSERT(!m_isActive); - m_isActive = true; - asyncUpdateController(); -} - -void GeolocationClientMock::stopUpdating() -{ - ASSERT(m_isActive); - m_isActive = false; - m_controllerTimer.stop(); -} - -void GeolocationClientMock::setEnableHighAccuracy(bool) -{ - // FIXME: We need to add some tests regarding "high accuracy" mode. - // See https://bugs.webkit.org/show_bug.cgi?id=49438 -} - -GeolocationPosition* GeolocationClientMock::lastPosition() -{ - return m_lastPosition.get(); -} - -void GeolocationClientMock::asyncUpdateController() -{ - ASSERT(m_controller); - if (m_isActive && !m_controllerTimer.isActive()) - m_controllerTimer.startOneShot(0); -} - -void GeolocationClientMock::controllerTimerFired(Timer<GeolocationClientMock>* timer) -{ - ASSERT_UNUSED(timer, timer == &m_controllerTimer); - ASSERT(m_controller); - - if (m_lastPosition.get()) { - ASSERT(!m_hasError); - m_controller->positionChanged(m_lastPosition.get()); - } else if (m_hasError) { - RefPtr<GeolocationError> geolocatioError = GeolocationError::create(GeolocationError::PositionUnavailable, m_errorMessage); - m_controller->errorOccurred(geolocatioError.get()); - } -} - -void GeolocationClientMock::clearError() -{ - m_hasError = false; - m_errorMessage = String(); -} - -} // WebCore diff --git a/chromium/third_party/WebKit/Source/core/platform/mock/GeolocationClientMock.h b/chromium/third_party/WebKit/Source/core/platform/mock/GeolocationClientMock.h deleted file mode 100644 index 884184d7741..00000000000 --- a/chromium/third_party/WebKit/Source/core/platform/mock/GeolocationClientMock.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * Copyright (C) 2012 Apple Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef GeolocationClientMock_h -#define GeolocationClientMock_h - -#include "modules/geolocation/GeolocationClient.h" -#include "platform/Timer.h" -#include "wtf/HashSet.h" -#include "wtf/PassRefPtr.h" -#include "wtf/RefPtr.h" -#include "wtf/text/WTFString.h" - -namespace WebCore { - -class GeolocationController; -class GeolocationPosition; - -// FIXME: this should not be in WebCore. It should be moved to WebKit. -// Provides a mock object for the geolocation client. -class GeolocationClientMock : public GeolocationClient { -public: - GeolocationClientMock(); - virtual ~GeolocationClientMock(); - - void reset(); - void setController(GeolocationController*); - - void setPosition(PassRefPtr<GeolocationPosition>); - void setPositionUnavailableError(const String& errorMessage); - void setPermission(bool allowed); - int numberOfPendingPermissionRequests() const; - - // GeolocationClient - virtual void geolocationDestroyed() OVERRIDE; - virtual void startUpdating() OVERRIDE; - virtual void stopUpdating() OVERRIDE; - virtual void setEnableHighAccuracy(bool) OVERRIDE; - virtual GeolocationPosition* lastPosition() OVERRIDE; - virtual void requestPermission(Geolocation*) OVERRIDE; - virtual void cancelPermissionRequest(Geolocation*) OVERRIDE; - -private: - void asyncUpdateController(); - void controllerTimerFired(Timer<GeolocationClientMock>*); - - void asyncUpdatePermission(); - void permissionTimerFired(Timer<GeolocationClientMock>*); - - void clearError(); - - GeolocationController* m_controller; - RefPtr<GeolocationPosition> m_lastPosition; - bool m_hasError; - String m_errorMessage; - Timer<GeolocationClientMock> m_controllerTimer; - Timer<GeolocationClientMock> m_permissionTimer; - bool m_isActive; - - enum PermissionState { - PermissionStateUnset, - PermissionStateAllowed, - PermissionStateDenied, - } m_permissionState; - typedef WTF::HashSet<RefPtr<Geolocation> > GeolocationSet; - GeolocationSet m_pendingPermission; -}; - -} - -#endif |