Merge from Chromium at DEPS revision 261286
This commit was generated by merge_to_master.py.
Change-Id: I756d37445fd7f470b1689ad81318e715d4244987
diff --git a/Source/web/AssertMatchingEnums.cpp b/Source/web/AssertMatchingEnums.cpp
index 39e3d6e..95faa95 100644
--- a/Source/web/AssertMatchingEnums.cpp
+++ b/Source/web/AssertMatchingEnums.cpp
@@ -45,6 +45,7 @@
#include "core/html/HTMLFormElement.h"
#include "core/html/HTMLInputElement.h"
#include "core/html/shadow/TextControlInnerElements.h"
+#include "core/loader/FrameLoaderTypes.h"
#include "core/loader/NavigationPolicy.h"
#include "core/loader/appcache/ApplicationCacheHost.h"
#include "core/page/InjectedStyleSheets.h"
@@ -110,6 +111,7 @@
#include "public/web/WebFormElement.h"
#include "public/web/WebGeolocationError.h"
#include "public/web/WebGeolocationPosition.h"
+#include "public/web/WebHistoryCommitType.h"
#include "public/web/WebIconURL.h"
#include "public/web/WebInputElement.h"
#include "public/web/WebInputEvent.h"
@@ -596,6 +598,11 @@
COMPILE_ASSERT_MATCHING_ENUM(WebNavigationPolicyNewWindow, NavigationPolicyNewWindow);
COMPILE_ASSERT_MATCHING_ENUM(WebNavigationPolicyNewPopup, NavigationPolicyNewPopup);
+COMPILE_ASSERT_MATCHING_ENUM(WebStandardCommit, StandardCommit);
+COMPILE_ASSERT_MATCHING_ENUM(WebBackForwardCommit, BackForwardCommit);
+COMPILE_ASSERT_MATCHING_ENUM(WebInitialCommitInChildFrame, InitialCommitInChildFrame);
+COMPILE_ASSERT_MATCHING_ENUM(WebHistoryInertCommit, HistoryInertCommit);
+
COMPILE_ASSERT_MATCHING_ENUM(WebConsoleMessage::LevelDebug, DebugMessageLevel);
COMPILE_ASSERT_MATCHING_ENUM(WebConsoleMessage::LevelLog, LogMessageLevel);
COMPILE_ASSERT_MATCHING_ENUM(WebConsoleMessage::LevelWarning, WarningMessageLevel);
diff --git a/Source/web/ChromeClientImpl.cpp b/Source/web/ChromeClientImpl.cpp
index 89b4c6d..c01d7ea 100644
--- a/Source/web/ChromeClientImpl.cpp
+++ b/Source/web/ChromeClientImpl.cpp
@@ -365,11 +365,24 @@
bool ChromeClientImpl::shouldReportDetailedMessageForSource(const String& url)
{
- return m_webView->client() && m_webView->client()->shouldReportDetailedMessageForSource(url);
+ WebFrameImpl* webframe = m_webView->mainFrameImpl();
+ // TODO(mkosiba): remove once Chrome side is updated.
+ bool shouldReport = m_webView->client() && m_webView->client()->shouldReportDetailedMessageForSource(url);
+ shouldReport &= webframe->client() && webframe->client()->shouldReportDetailedMessageForSource(url);
+ return shouldReport;
}
void ChromeClientImpl::addMessageToConsole(MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceID, const String& stackTrace)
{
+ WebFrameImpl* webframe = m_webView->mainFrameImpl();
+ if (webframe->client()) {
+ webframe->client()->didAddMessageToConsole(
+ WebConsoleMessage(static_cast<WebConsoleMessage::Level>(level), message),
+ sourceID,
+ lineNumber,
+ stackTrace);
+ }
+ // TODO(mkosiba): remove once Chrome side is updated.
if (m_webView->client()) {
m_webView->client()->didAddMessageToConsole(
WebConsoleMessage(static_cast<WebConsoleMessage::Level>(level), message),
diff --git a/Source/web/ContextMenuClientImpl.cpp b/Source/web/ContextMenuClientImpl.cpp
index 2610a32..e15b951 100644
--- a/Source/web/ContextMenuClientImpl.cpp
+++ b/Source/web/ContextMenuClientImpl.cpp
@@ -242,8 +242,12 @@
data.mediaFlags |= WebContextMenuData::MediaCanSave;
if (mediaElement->hasAudio())
data.mediaFlags |= WebContextMenuData::MediaHasAudio;
- if (mediaElement->hasVideo())
- data.mediaFlags |= WebContextMenuData::MediaHasVideo;
+ // Media controls can be toggled only for video player. If we toggle
+ // controls for audio then the player disappears, and there is no way to
+ // return it back. Don't set this bit for fullscreen video, since
+ // toggling is ignored in that case.
+ if (mediaElement->hasVideo() && !mediaElement->isFullscreen())
+ data.mediaFlags |= WebContextMenuData::MediaCanToggleControls;
if (mediaElement->controls())
data.mediaFlags |= WebContextMenuData::MediaControls;
} else if (isHTMLObjectElement(*r.innerNonSharedNode()) || isHTMLEmbedElement(*r.innerNonSharedNode())) {
diff --git a/Source/web/PageScaleConstraintsSet.cpp b/Source/web/PageScaleConstraintsSet.cpp
index 4460ca7..e9d363c 100644
--- a/Source/web/PageScaleConstraintsSet.cpp
+++ b/Source/web/PageScaleConstraintsSet.cpp
@@ -31,6 +31,7 @@
#include "config.h"
#include "PageScaleConstraintsSet.h"
+#include "platform/Length.h"
#include "wtf/Assertions.h"
using namespace WebCore;
@@ -53,9 +54,9 @@
return PageScaleConstraints(-1, defaultMinimumScale, defaultMaximumScale);
}
-void PageScaleConstraintsSet::updatePageDefinedConstraints(const ViewportDescription& description, IntSize viewSize)
+void PageScaleConstraintsSet::updatePageDefinedConstraints(const ViewportDescription& description, IntSize viewSize, Length legacyFallbackWidth)
{
- m_pageDefinedConstraints = description.resolve(viewSize);
+ m_pageDefinedConstraints = description.resolve(viewSize, legacyFallbackWidth);
m_constraintsDirty = true;
}
diff --git a/Source/web/PageScaleConstraintsSet.h b/Source/web/PageScaleConstraintsSet.h
index b31d4e4..af14188 100644
--- a/Source/web/PageScaleConstraintsSet.h
+++ b/Source/web/PageScaleConstraintsSet.h
@@ -33,6 +33,7 @@
#include "core/dom/ViewportDescription.h"
#include "core/page/PageScaleConstraints.h"
+#include "platform/Length.h"
#include "platform/geometry/IntSize.h"
namespace blink {
@@ -48,7 +49,7 @@
// Settings defined in the website's viewport tag, if viewport tag support
// is enabled.
const WebCore::PageScaleConstraints& pageDefinedConstraints() const { return m_pageDefinedConstraints; }
- void updatePageDefinedConstraints(const WebCore::ViewportDescription&, WebCore::IntSize viewSize);
+ void updatePageDefinedConstraints(const WebCore::ViewportDescription&, WebCore::IntSize viewSize, WebCore::Length legacyFallbackWidth);
void adjustForAndroidWebViewQuirks(const WebCore::ViewportDescription&, WebCore::IntSize viewSize, int layoutFallbackWidth, float deviceScaleFactor, bool supportTargetDensityDPI, bool wideViewportQuirkEnabled, bool useWideViewport, bool loadWithOverviewMode, bool nonUserScalableQuirkEnabled);
// Constraints may also be set from Chromium -- this overrides any
diff --git a/Source/web/WebFrameImpl.cpp b/Source/web/WebFrameImpl.cpp
index 9c9c69c..487e80c 100644
--- a/Source/web/WebFrameImpl.cpp
+++ b/Source/web/WebFrameImpl.cpp
@@ -162,8 +162,6 @@
#include "core/rendering/RenderView.h"
#include "core/rendering/style/StyleInheritedData.h"
#include "core/timing/Performance.h"
-#include "core/xml/DocumentXPathEvaluator.h"
-#include "core/xml/XPathResult.h"
#include "platform/TraceEvent.h"
#include "platform/UserGestureIndicator.h"
#include "platform/clipboard/ClipboardUtilities.h"
@@ -713,24 +711,6 @@
return fromFrame(frame()->tree().child(name));
}
-WebFrame* WebFrameImpl::findChildByExpression(const WebString& xpath) const
-{
- if (xpath.isEmpty())
- return 0;
-
- Document* document = frame()->document();
- ASSERT(document);
-
- RefPtrWillBeRawPtr<XPathResult> xpathResult = DocumentXPathEvaluator::evaluate(*document, xpath, document, nullptr, XPathResult::ORDERED_NODE_ITERATOR_TYPE, 0, IGNORE_EXCEPTION);
- if (!xpathResult)
- return 0;
-
- Node* node = xpathResult->iterateNext(IGNORE_EXCEPTION);
- if (!node || !node->isFrameOwnerElement())
- return 0;
- return fromFrame(toLocalFrame(toHTMLFrameOwnerElement(node)->contentFrame()));
-}
-
WebDocument WebFrameImpl::document() const
{
if (!frame() || !frame()->document())
@@ -752,6 +732,13 @@
return frame()->loader().shouldClose();
}
+void WebFrameImpl::dispatchUnloadEvent()
+{
+ if (!frame())
+ return;
+ frame()->loader().closeURL();
+}
+
NPObject* WebFrameImpl::windowObject() const
{
if (!frame())
@@ -1720,12 +1707,15 @@
// If we're moving in the back/forward list, we might want to replace the content
// of this child frame with whatever was there at that point.
- HistoryItem* childItem = 0;
- if (isBackForwardLoadType(frame()->loader().loadType()) && !frame()->document()->loadEventFinished())
- childItem = frame()->page()->historyController().itemForNewChildFrame(childFrame.get());
+ RefPtr<HistoryItem> childItem;
+ if (isBackForwardLoadType(frame()->loader().loadType()) && !frame()->document()->loadEventFinished()) {
+ childItem = PassRefPtr<HistoryItem>(webframe->client()->historyItemForNewChildFrame(webframe));
+ if (!childItem)
+ childItem = frame()->page()->historyController().itemForNewChildFrame(childFrame.get());
+ }
if (childItem)
- childFrame->loader().loadHistoryItem(childItem);
+ childFrame->loader().loadHistoryItem(childItem.get());
else
childFrame->loader().load(FrameLoadRequest(0, request.resourceRequest(), "_self"));
diff --git a/Source/web/WebFrameImpl.h b/Source/web/WebFrameImpl.h
index a55181b..452c136 100644
--- a/Source/web/WebFrameImpl.h
+++ b/Source/web/WebFrameImpl.h
@@ -111,10 +111,10 @@
virtual WebFrame* traversePrevious(bool wrap) const OVERRIDE;
virtual WebFrame* traverseNext(bool wrap) const OVERRIDE;
virtual WebFrame* findChildByName(const WebString&) const OVERRIDE;
- virtual WebFrame* findChildByExpression(const WebString&) const OVERRIDE;
virtual WebDocument document() const OVERRIDE;
virtual WebPerformance performance() const OVERRIDE;
virtual bool dispatchBeforeUnloadEvent() OVERRIDE;
+ virtual void dispatchUnloadEvent() OVERRIDE;
virtual NPObject* windowObject() const OVERRIDE;
virtual void bindToWindowObject(const WebString& name, NPObject*) OVERRIDE;
virtual void bindToWindowObject(const WebString& name, NPObject*, void*) OVERRIDE;
diff --git a/Source/web/WebPagePopupImpl.cpp b/Source/web/WebPagePopupImpl.cpp
index 2a20ed1..0103445 100644
--- a/Source/web/WebPagePopupImpl.cpp
+++ b/Source/web/WebPagePopupImpl.cpp
@@ -264,7 +264,7 @@
m_widgetClient->didDeactivateCompositor();
} else if (m_layerTreeView) {
m_isAcceleratedCompositingActive = true;
- m_widgetClient->didActivateCompositor(0);
+ m_widgetClient->didActivateCompositor();
} else {
TRACE_EVENT0("webkit", "WebPagePopupImpl::setIsAcceleratedCompositingActive(true)");
@@ -272,7 +272,7 @@
m_layerTreeView = m_widgetClient->layerTreeView();
if (m_layerTreeView) {
m_layerTreeView->setVisible(true);
- m_widgetClient->didActivateCompositor(0);
+ m_widgetClient->didActivateCompositor();
m_isAcceleratedCompositingActive = true;
m_layerTreeView->setDeviceScaleFactor(m_widgetClient->deviceScaleFactor());
} else {
diff --git a/Source/web/WebPopupMenuImpl.cpp b/Source/web/WebPopupMenuImpl.cpp
index 36570d8..6d88d70 100644
--- a/Source/web/WebPopupMenuImpl.cpp
+++ b/Source/web/WebPopupMenuImpl.cpp
@@ -214,7 +214,7 @@
m_client->didDeactivateCompositor();
} else if (m_layerTreeView) {
m_isAcceleratedCompositingActive = true;
- m_client->didActivateCompositor(0);
+ m_client->didActivateCompositor();
} else {
TRACE_EVENT0("webkit", "WebPopupMenuImpl::enterForceCompositingMode(true)");
@@ -222,7 +222,7 @@
m_layerTreeView = m_client->layerTreeView();
if (m_layerTreeView) {
m_layerTreeView->setVisible(true);
- m_client->didActivateCompositor(0);
+ m_client->didActivateCompositor();
m_isAcceleratedCompositingActive = true;
m_layerTreeView->setDeviceScaleFactor(m_client->deviceScaleFactor());
m_rootLayer = adoptPtr(Platform::current()->compositorSupport()->createContentLayer(this));
diff --git a/Source/web/WebSettingsImpl.cpp b/Source/web/WebSettingsImpl.cpp
index 1a1ef88..99d4360 100644
--- a/Source/web/WebSettingsImpl.cpp
+++ b/Source/web/WebSettingsImpl.cpp
@@ -53,6 +53,7 @@
, m_deferredImageDecodingEnabled(false)
, m_doubleTapToZoomEnabled(false)
, m_supportDeprecatedTargetDensityDPI(false)
+ , m_shrinksViewportContentToFit(false)
, m_viewportMetaLayoutSizeQuirk(false)
, m_viewportMetaNonUserScalableQuirk(false)
, m_clobberUserAgentInitialScaleQuirk(false)
@@ -258,6 +259,11 @@
m_settings->setShrinksStandaloneImagesToFit(shrinkImages);
}
+void WebSettingsImpl::setShrinksViewportContentToFit(bool shrinkViewportContent)
+{
+ m_shrinksViewportContentToFit = shrinkViewportContent;
+}
+
void WebSettingsImpl::setSpatialNavigationEnabled(bool enabled)
{
m_settings->setSpatialNavigationEnabled(enabled);
@@ -558,11 +564,6 @@
m_settings->setLayerSquashingEnabled(enabled);
}
-void WebSettingsImpl::setLayoutFallbackWidth(int width)
-{
- m_settings->setLayoutFallbackWidth(width);
-}
-
void WebSettingsImpl::setAsynchronousSpellCheckingEnabled(bool enabled)
{
m_settings->setAsynchronousSpellCheckingEnabled(enabled);
@@ -653,6 +654,11 @@
return m_mainFrameResizesAreOrientationChanges;
}
+bool WebSettingsImpl::shrinksViewportContentToFit() const
+{
+ return m_shrinksViewportContentToFit;
+}
+
void WebSettingsImpl::setShouldRespectImageOrientation(bool enabled)
{
m_settings->setShouldRespectImageOrientation(enabled);
diff --git a/Source/web/WebSettingsImpl.h b/Source/web/WebSettingsImpl.h
index a20062c..c784a86 100644
--- a/Source/web/WebSettingsImpl.h
+++ b/Source/web/WebSettingsImpl.h
@@ -46,6 +46,7 @@
virtual ~WebSettingsImpl() { }
virtual bool mainFrameResizesAreOrientationChanges() const OVERRIDE;
+ virtual bool shrinksViewportContentToFit() const OVERRIDE;
virtual bool scrollAnimatorEnabled() const OVERRIDE;
virtual bool touchEditingEnabled() const OVERRIDE;
virtual bool viewportEnabled() const OVERRIDE;
@@ -114,7 +115,6 @@
virtual void setJavaScriptCanOpenWindowsAutomatically(bool) OVERRIDE;
virtual void setJavaScriptEnabled(bool) OVERRIDE;
virtual void setLayerSquashingEnabled(bool) OVERRIDE;
- virtual void setLayoutFallbackWidth(int) OVERRIDE;
virtual void setLoadsImagesAutomatically(bool) OVERRIDE;
virtual void setLoadWithOverviewMode(bool) OVERRIDE;
virtual void setLocalStorageEnabled(bool) OVERRIDE;
@@ -149,6 +149,7 @@
virtual void setShowFPSCounter(bool) OVERRIDE;
virtual void setShowPaintRects(bool) OVERRIDE;
virtual void setShrinksStandaloneImagesToFit(bool) OVERRIDE;
+ virtual void setShrinksViewportContentToFit(bool) OVERRIDE;
virtual void setSmartInsertDeleteEnabled(bool) OVERRIDE;
virtual void setSpatialNavigationEnabled(bool) OVERRIDE;
virtual void setStandardFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) OVERRIDE;
@@ -207,6 +208,7 @@
bool m_doubleTapToZoomEnabled;
bool m_perTilePaintingEnabled;
bool m_supportDeprecatedTargetDensityDPI;
+ bool m_shrinksViewportContentToFit;
// This quirk is to maintain compatibility with Android apps built on
// the Android SDK prior to and including version 18. Presumably, this
// can be removed any time after 2015. See http://crbug.com/277369.
diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp
index 2d3c409..dfc1cd4 100644
--- a/Source/web/WebViewImpl.cpp
+++ b/Source/web/WebViewImpl.cpp
@@ -113,6 +113,7 @@
#include "core/page/PointerLockController.h"
#include "core/page/ScopedPageLoadDeferrer.h"
#include "core/page/TouchDisambiguation.h"
+#include "core/rendering/FastTextAutosizer.h"
#include "core/rendering/RenderView.h"
#include "core/rendering/RenderWidget.h"
#include "core/rendering/TextAutosizer.h"
@@ -358,14 +359,10 @@
, m_layerTreeViewCommitsDeferred(false)
, m_compositorCreationFailed(false)
, m_recreatingGraphicsContext(false)
-#if ENABLE(INPUT_SPEECH)
- , m_speechInputClient(SpeechInputClientImpl::create(client))
-#endif
, m_speechRecognitionClient(SpeechRecognitionClientProxy::create(client ? client->speechRecognizer() : 0))
, m_geolocationClientProxy(adoptPtr(new GeolocationClientProxy(client ? client->geolocationClient() : 0)))
, m_userMediaClientImpl(this)
, m_midiClientProxy(adoptPtr(new MIDIClientProxy(client ? client->webMIDIClient() : 0)))
- , m_navigatorContentUtilsClient(NavigatorContentUtilsClientImpl::create(this))
, m_flingModifier(0)
, m_flingSourceDevice(false)
, m_fullscreenController(FullscreenController::create(this))
@@ -393,11 +390,11 @@
MediaKeysController::provideMediaKeysTo(*m_page, &m_mediaKeysClientImpl);
provideMIDITo(*m_page, m_midiClientProxy.get());
#if ENABLE(INPUT_SPEECH)
- provideSpeechInputTo(*m_page, m_speechInputClient.get());
+ provideSpeechInputTo(*m_page, SpeechInputClientImpl::create(client));
#endif
provideSpeechRecognitionTo(*m_page, m_speechRecognitionClient.get());
provideNotification(*m_page, notificationPresenterImpl());
- provideNavigatorContentUtilsTo(*m_page, m_navigatorContentUtilsClient.get());
+ provideNavigatorContentUtilsTo(*m_page, NavigatorContentUtilsClientImpl::create(this));
provideContextFeaturesTo(*m_page, m_featureSwitchClient.get());
if (RuntimeEnabledFeatures::deviceOrientationEnabled())
@@ -1566,17 +1563,22 @@
FloatSize(viewportAnchorXCoord, viewportAnchorYCoord));
}
- updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document()->viewportDescription());
- updateMainFrameLayoutSize();
+ {
+ // Avoids unnecessary invalidations while various bits of state in FastTextAutosizer are updated.
+ FastTextAutosizer::DeferUpdatePageInfo deferUpdatePageInfo(page());
- WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate();
- if (agentPrivate)
- agentPrivate->webViewResized(newSize);
- WebFrameImpl* webFrame = mainFrameImpl();
- if (webFrame->frameView()) {
- webFrame->frameView()->resize(m_size);
- if (page()->settings().pinchVirtualViewportEnabled())
- page()->frameHost().pinchViewport().setSize(m_size);
+ updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document()->viewportDescription());
+ updateMainFrameLayoutSize();
+
+ WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate();
+ if (agentPrivate)
+ agentPrivate->webViewResized(newSize);
+ WebFrameImpl* webFrame = mainFrameImpl();
+ if (webFrame->frameView()) {
+ webFrame->frameView()->resize(m_size);
+ if (page()->settings().pinchVirtualViewportEnabled())
+ page()->frameHost().pinchViewport().setSize(m_size);
+ }
}
if (settings()->viewportEnabled() && !m_fixedLayoutSizeLock) {
@@ -2401,21 +2403,6 @@
m_page->mainFrame()->loader().reload(NormalReload, KURL(), newEncodingName);
}
-bool WebViewImpl::dispatchBeforeUnloadEvent()
-{
- WebFrame* frame = mainFrame();
- if (!frame)
- return true;
-
- return frame->dispatchBeforeUnloadEvent();
-}
-
-void WebViewImpl::dispatchUnloadEvent()
-{
- // Run unload handlers.
- m_page->mainFrame()->loader().closeURL();
-}
-
WebFrame* WebViewImpl::mainFrame()
{
return mainFrameImpl();
@@ -2810,10 +2797,14 @@
if (!settings()->viewportEnabled() || !page() || (!m_size.width && !m_size.height))
return;
+ Document* document = page()->mainFrame()->document();
+
+ Length defaultMinWidth = document->viewportDefaultMinWidth();
+ if (defaultMinWidth.isAuto())
+ defaultMinWidth = Length(ExtendToZoom);
+
ViewportDescription adjustedDescription = description;
if (settingsImpl()->viewportMetaLayoutSizeQuirk() && adjustedDescription.type == ViewportDescription::ViewportMeta) {
- if (adjustedDescription.maxWidth.type() == ExtendToZoom)
- adjustedDescription.maxWidth = Length(); // auto
const int legacyWidthSnappingMagicNumber = 320;
if (adjustedDescription.maxWidth.isFixed() && adjustedDescription.maxWidth.value() <= legacyWidthSnappingMagicNumber)
adjustedDescription.maxWidth = Length(DeviceWidth);
@@ -2822,17 +2813,19 @@
adjustedDescription.minWidth = adjustedDescription.maxWidth;
adjustedDescription.minHeight = adjustedDescription.maxHeight;
}
+
float oldInitialScale = m_pageScaleConstraintsSet.pageDefinedConstraints().initialScale;
- m_pageScaleConstraintsSet.updatePageDefinedConstraints(adjustedDescription, m_size);
+ m_pageScaleConstraintsSet.updatePageDefinedConstraints(adjustedDescription, m_size, defaultMinWidth);
if (settingsImpl()->clobberUserAgentInitialScaleQuirk()
&& m_pageScaleConstraintsSet.userAgentConstraints().initialScale != -1
&& m_pageScaleConstraintsSet.userAgentConstraints().initialScale * deviceScaleFactor() <= 1) {
if (description.maxWidth == Length(DeviceWidth)
- || (description.maxWidth.type() == ExtendToZoom && m_pageScaleConstraintsSet.pageDefinedConstraints().initialScale == 1.0f))
+ || (description.maxWidth.type() == Auto && m_pageScaleConstraintsSet.pageDefinedConstraints().initialScale == 1.0f))
setInitialPageScaleOverride(-1);
}
- m_pageScaleConstraintsSet.adjustForAndroidWebViewQuirks(adjustedDescription, m_size, page()->settings().layoutFallbackWidth(), deviceScaleFactor(), settingsImpl()->supportDeprecatedTargetDensityDPI(), page()->settings().wideViewportQuirkEnabled(), page()->settings().useWideViewport(), page()->settings().loadWithOverviewMode(), settingsImpl()->viewportMetaNonUserScalableQuirk());
+
+ m_pageScaleConstraintsSet.adjustForAndroidWebViewQuirks(adjustedDescription, m_size, defaultMinWidth.intValue(), deviceScaleFactor(), settingsImpl()->supportDeprecatedTargetDensityDPI(), page()->settings().wideViewportQuirkEnabled(), page()->settings().useWideViewport(), page()->settings().loadWithOverviewMode(), settingsImpl()->viewportMetaNonUserScalableQuirk());
float newInitialScale = m_pageScaleConstraintsSet.pageDefinedConstraints().initialScale;
if (oldInitialScale != newInitialScale && newInitialScale != -1) {
m_pageScaleConstraintsSet.setNeedsReset(true);
@@ -2841,6 +2834,11 @@
}
updateMainFrameLayoutSize();
+
+ if (LocalFrame* frame = page()->mainFrame()) {
+ if (FastTextAutosizer* textAutosizer = frame->document()->fastTextAutosizer())
+ textAutosizer->updatePageInfoInAllFrames();
+ }
}
void WebViewImpl::updateMainFrameLayoutSize()
@@ -2859,8 +2857,7 @@
bool textAutosizingEnabled = page()->settings().textAutosizingEnabled();
if (textAutosizingEnabled && layoutSize.width != view->layoutSize().width()) {
- TextAutosizer* textAutosizer = page()->mainFrame()->document()->textAutosizer();
- if (textAutosizer)
+ if (TextAutosizer* textAutosizer = page()->mainFrame()->document()->textAutosizer())
textAutosizer->recalculateMultipliers();
}
}
@@ -3739,7 +3736,7 @@
if (m_pageOverlays)
m_pageOverlays->update();
- m_client->didActivateCompositor(0);
+ m_client->didActivateCompositor();
} else {
TRACE_EVENT0("webkit", "WebViewImpl::setIsAcceleratedCompositingActive(true)");
@@ -3760,7 +3757,7 @@
m_layerTreeView->setOverhangBitmap(overhangImage->nativeImageForCurrentFrame()->bitmap());
#endif
updateLayerTreeViewport();
- m_client->didActivateCompositor(0);
+ m_client->didActivateCompositor();
m_isAcceleratedCompositingActive = true;
m_compositorCreationFailed = false;
if (m_pageOverlays)
diff --git a/Source/web/WebViewImpl.h b/Source/web/WebViewImpl.h
index be4e02d..8128e2f 100644
--- a/Source/web/WebViewImpl.h
+++ b/Source/web/WebViewImpl.h
@@ -187,8 +187,6 @@
virtual void setIsActive(bool value) OVERRIDE;
virtual void setDomainRelaxationForbidden(bool, const WebString& scheme) OVERRIDE;
virtual void setWindowFeatures(const WebWindowFeatures&) OVERRIDE;
- virtual bool dispatchBeforeUnloadEvent() OVERRIDE;
- virtual void dispatchUnloadEvent() OVERRIDE;
virtual WebFrame* mainFrame() OVERRIDE;
virtual WebFrame* findFrameByName(
const WebString& name, WebFrame* relativeToFrame) OVERRIDE;
@@ -737,9 +735,6 @@
bool m_recreatingGraphicsContext;
static const WebInputEvent* m_currentInputEvent;
-#if ENABLE(INPUT_SPEECH)
- OwnPtr<SpeechInputClientImpl> m_speechInputClient;
-#endif
OwnPtr<SpeechRecognitionClientProxy> m_speechRecognitionClient;
OwnPtr<GeolocationClientProxy> m_geolocationClientProxy;
@@ -747,7 +742,6 @@
UserMediaClientImpl m_userMediaClientImpl;
MediaKeysClientImpl m_mediaKeysClientImpl;
OwnPtr<MIDIClientProxy> m_midiClientProxy;
- OwnPtr<NavigatorContentUtilsClientImpl> m_navigatorContentUtilsClient;
OwnPtr<WebActiveGestureAnimation> m_gestureAnimation;
WebPoint m_positionOnFlingStart;
WebPoint m_globalPositionOnFlingStart;
diff --git a/Source/web/blink_web.target.darwin-arm.mk b/Source/web/blink_web.target.darwin-arm.mk
index bbfb6ab..7abea31 100644
--- a/Source/web/blink_web.target.darwin-arm.mk
+++ b/Source/web/blink_web.target.darwin-arm.mk
@@ -303,6 +303,7 @@
'-DDISABLE_NACL' \
'-DCHROMIUM_BUILD' \
'-DUSE_LIBJPEG_TURBO=1' \
+ '-DENABLE_WEBRTC=1' \
'-DUSE_PROPRIETARY_CODECS' \
'-DENABLE_CONFIGURATION_POLICY' \
'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
@@ -446,6 +447,7 @@
'-DDISABLE_NACL' \
'-DCHROMIUM_BUILD' \
'-DUSE_LIBJPEG_TURBO=1' \
+ '-DENABLE_WEBRTC=1' \
'-DUSE_PROPRIETARY_CODECS' \
'-DENABLE_CONFIGURATION_POLICY' \
'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
diff --git a/Source/web/blink_web.target.darwin-mips.mk b/Source/web/blink_web.target.darwin-mips.mk
index 29f15ca..a67fff5 100644
--- a/Source/web/blink_web.target.darwin-mips.mk
+++ b/Source/web/blink_web.target.darwin-mips.mk
@@ -302,6 +302,7 @@
'-DDISABLE_NACL' \
'-DCHROMIUM_BUILD' \
'-DUSE_LIBJPEG_TURBO=1' \
+ '-DENABLE_WEBRTC=1' \
'-DUSE_PROPRIETARY_CODECS' \
'-DENABLE_CONFIGURATION_POLICY' \
'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
@@ -444,6 +445,7 @@
'-DDISABLE_NACL' \
'-DCHROMIUM_BUILD' \
'-DUSE_LIBJPEG_TURBO=1' \
+ '-DENABLE_WEBRTC=1' \
'-DUSE_PROPRIETARY_CODECS' \
'-DENABLE_CONFIGURATION_POLICY' \
'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
diff --git a/Source/web/blink_web.target.darwin-x86.mk b/Source/web/blink_web.target.darwin-x86.mk
index 5fc2908..dbb292c 100644
--- a/Source/web/blink_web.target.darwin-x86.mk
+++ b/Source/web/blink_web.target.darwin-x86.mk
@@ -304,6 +304,7 @@
'-DDISABLE_NACL' \
'-DCHROMIUM_BUILD' \
'-DUSE_LIBJPEG_TURBO=1' \
+ '-DENABLE_WEBRTC=1' \
'-DUSE_PROPRIETARY_CODECS' \
'-DENABLE_CONFIGURATION_POLICY' \
'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
@@ -447,6 +448,7 @@
'-DDISABLE_NACL' \
'-DCHROMIUM_BUILD' \
'-DUSE_LIBJPEG_TURBO=1' \
+ '-DENABLE_WEBRTC=1' \
'-DUSE_PROPRIETARY_CODECS' \
'-DENABLE_CONFIGURATION_POLICY' \
'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
diff --git a/Source/web/blink_web.target.darwin-x86_64.mk b/Source/web/blink_web.target.darwin-x86_64.mk
index 1a7e3c4..5a712c0 100644
--- a/Source/web/blink_web.target.darwin-x86_64.mk
+++ b/Source/web/blink_web.target.darwin-x86_64.mk
@@ -304,6 +304,7 @@
'-DDISABLE_NACL' \
'-DCHROMIUM_BUILD' \
'-DUSE_LIBJPEG_TURBO=1' \
+ '-DENABLE_WEBRTC=1' \
'-DUSE_PROPRIETARY_CODECS' \
'-DENABLE_CONFIGURATION_POLICY' \
'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
@@ -447,6 +448,7 @@
'-DDISABLE_NACL' \
'-DCHROMIUM_BUILD' \
'-DUSE_LIBJPEG_TURBO=1' \
+ '-DENABLE_WEBRTC=1' \
'-DUSE_PROPRIETARY_CODECS' \
'-DENABLE_CONFIGURATION_POLICY' \
'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
diff --git a/Source/web/blink_web.target.linux-arm.mk b/Source/web/blink_web.target.linux-arm.mk
index bbfb6ab..7abea31 100644
--- a/Source/web/blink_web.target.linux-arm.mk
+++ b/Source/web/blink_web.target.linux-arm.mk
@@ -303,6 +303,7 @@
'-DDISABLE_NACL' \
'-DCHROMIUM_BUILD' \
'-DUSE_LIBJPEG_TURBO=1' \
+ '-DENABLE_WEBRTC=1' \
'-DUSE_PROPRIETARY_CODECS' \
'-DENABLE_CONFIGURATION_POLICY' \
'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
@@ -446,6 +447,7 @@
'-DDISABLE_NACL' \
'-DCHROMIUM_BUILD' \
'-DUSE_LIBJPEG_TURBO=1' \
+ '-DENABLE_WEBRTC=1' \
'-DUSE_PROPRIETARY_CODECS' \
'-DENABLE_CONFIGURATION_POLICY' \
'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
diff --git a/Source/web/blink_web.target.linux-mips.mk b/Source/web/blink_web.target.linux-mips.mk
index 29f15ca..a67fff5 100644
--- a/Source/web/blink_web.target.linux-mips.mk
+++ b/Source/web/blink_web.target.linux-mips.mk
@@ -302,6 +302,7 @@
'-DDISABLE_NACL' \
'-DCHROMIUM_BUILD' \
'-DUSE_LIBJPEG_TURBO=1' \
+ '-DENABLE_WEBRTC=1' \
'-DUSE_PROPRIETARY_CODECS' \
'-DENABLE_CONFIGURATION_POLICY' \
'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
@@ -444,6 +445,7 @@
'-DDISABLE_NACL' \
'-DCHROMIUM_BUILD' \
'-DUSE_LIBJPEG_TURBO=1' \
+ '-DENABLE_WEBRTC=1' \
'-DUSE_PROPRIETARY_CODECS' \
'-DENABLE_CONFIGURATION_POLICY' \
'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
diff --git a/Source/web/blink_web.target.linux-x86.mk b/Source/web/blink_web.target.linux-x86.mk
index 5fc2908..dbb292c 100644
--- a/Source/web/blink_web.target.linux-x86.mk
+++ b/Source/web/blink_web.target.linux-x86.mk
@@ -304,6 +304,7 @@
'-DDISABLE_NACL' \
'-DCHROMIUM_BUILD' \
'-DUSE_LIBJPEG_TURBO=1' \
+ '-DENABLE_WEBRTC=1' \
'-DUSE_PROPRIETARY_CODECS' \
'-DENABLE_CONFIGURATION_POLICY' \
'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
@@ -447,6 +448,7 @@
'-DDISABLE_NACL' \
'-DCHROMIUM_BUILD' \
'-DUSE_LIBJPEG_TURBO=1' \
+ '-DENABLE_WEBRTC=1' \
'-DUSE_PROPRIETARY_CODECS' \
'-DENABLE_CONFIGURATION_POLICY' \
'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
diff --git a/Source/web/blink_web.target.linux-x86_64.mk b/Source/web/blink_web.target.linux-x86_64.mk
index 1a7e3c4..5a712c0 100644
--- a/Source/web/blink_web.target.linux-x86_64.mk
+++ b/Source/web/blink_web.target.linux-x86_64.mk
@@ -304,6 +304,7 @@
'-DDISABLE_NACL' \
'-DCHROMIUM_BUILD' \
'-DUSE_LIBJPEG_TURBO=1' \
+ '-DENABLE_WEBRTC=1' \
'-DUSE_PROPRIETARY_CODECS' \
'-DENABLE_CONFIGURATION_POLICY' \
'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
@@ -447,6 +448,7 @@
'-DDISABLE_NACL' \
'-DCHROMIUM_BUILD' \
'-DUSE_LIBJPEG_TURBO=1' \
+ '-DENABLE_WEBRTC=1' \
'-DUSE_PROPRIETARY_CODECS' \
'-DENABLE_CONFIGURATION_POLICY' \
'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
diff --git a/Source/web/tests/DragImageTest.cpp b/Source/web/tests/DragImageTest.cpp
index 4c20e27..4633700 100644
--- a/Source/web/tests/DragImageTest.cpp
+++ b/Source/web/tests/DragImageTest.cpp
@@ -63,8 +63,9 @@
: Image(0)
, m_size(size)
{
- m_nativeImage = NativeImageSkia::create();
- EXPECT_TRUE(m_nativeImage->bitmap().allocN32Pixels(size.width(), size.height()));
+ SkBitmap bitmap;
+ EXPECT_TRUE(bitmap.allocN32Pixels(size.width(), size.height()));
+ m_nativeImage = NativeImageSkia::create(bitmap);
}
virtual IntSize size() const OVERRIDE
diff --git a/Source/web/tests/FilterOperationsTest.cpp b/Source/web/tests/FilterOperationsTest.cpp
deleted file mode 100644
index 93bcf28..0000000
--- a/Source/web/tests/FilterOperationsTest.cpp
+++ /dev/null
@@ -1,61 +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 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 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 "platform/graphics/filters/FilterOperations.h"
-
-#include <gtest/gtest.h>
-
-using namespace WebCore;
-using namespace blink;
-
-namespace {
-
-TEST(FilterOperationsTest, getOutsetsBlur)
-{
- FilterOperations ops;
- ops.operations().append(BlurFilterOperation::create(Length(20.0, WebCore::Fixed)));
- EXPECT_TRUE(ops.hasOutsets());
- FilterOutsets outsets = ops.outsets();
- EXPECT_EQ(57, outsets.top());
- EXPECT_EQ(57, outsets.right());
- EXPECT_EQ(57, outsets.bottom());
- EXPECT_EQ(57, outsets.left());
-}
-
-TEST(FilterOperationsTest, getOutsetsDropShadow)
-{
- FilterOperations ops;
- ops.operations().append(DropShadowFilterOperation::create(IntPoint(3, 8), 20, Color(1, 2, 3)));
- EXPECT_TRUE(ops.hasOutsets());
- FilterOutsets outsets = ops.outsets();
- EXPECT_EQ(49, outsets.top());
- EXPECT_EQ(60, outsets.right());
- EXPECT_EQ(65, outsets.bottom());
- EXPECT_EQ(54, outsets.left());
-}
-
-}
-
diff --git a/Source/web/tests/GraphicsLayerTest.cpp b/Source/web/tests/GraphicsLayerTest.cpp
deleted file mode 100644
index fff5d6d..0000000
--- a/Source/web/tests/GraphicsLayerTest.cpp
+++ /dev/null
@@ -1,168 +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 "platform/graphics/GraphicsLayer.h"
-
-#include "platform/scroll/ScrollableArea.h"
-#include "platform/transforms/Matrix3DTransformOperation.h"
-#include "platform/transforms/RotateTransformOperation.h"
-#include "platform/transforms/TranslateTransformOperation.h"
-#include "wtf/PassOwnPtr.h"
-
-#include <gtest/gtest.h>
-#include "public/platform/Platform.h"
-#include "public/platform/WebCompositorSupport.h"
-#include "public/platform/WebFloatAnimationCurve.h"
-#include "public/platform/WebGraphicsContext3D.h"
-#include "public/platform/WebLayer.h"
-#include "public/platform/WebLayerTreeView.h"
-#include "public/platform/WebUnitTestSupport.h"
-
-using namespace WebCore;
-using namespace blink;
-
-namespace {
-
-class MockGraphicsLayerClient : public GraphicsLayerClient {
-public:
- virtual void notifyAnimationStarted(const GraphicsLayer*, double monotonicTime) OVERRIDE { }
- virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& inClip) OVERRIDE { }
- virtual String debugName(const GraphicsLayer*) OVERRIDE { return String(); }
-};
-
-class GraphicsLayerForTesting : public GraphicsLayer {
-public:
- explicit GraphicsLayerForTesting(GraphicsLayerClient* client)
- : GraphicsLayer(client) { };
-
- virtual blink::WebLayer* contentsLayer() const { return GraphicsLayer::contentsLayer(); }
-};
-
-class GraphicsLayerTest : public testing::Test {
-public:
- GraphicsLayerTest()
- {
- m_clipLayer = adoptPtr(new GraphicsLayerForTesting(&m_client));
- m_graphicsLayer = adoptPtr(new GraphicsLayerForTesting(&m_client));
- m_clipLayer->addChild(m_graphicsLayer.get());
- m_graphicsLayer->platformLayer()->setScrollClipLayer(
- m_clipLayer->platformLayer());
- m_platformLayer = m_graphicsLayer->platformLayer();
- m_layerTreeView = adoptPtr(Platform::current()->unitTestSupport()->createLayerTreeViewForTesting(WebUnitTestSupport::TestViewTypeUnitTest));
- ASSERT(m_layerTreeView);
- m_layerTreeView->setRootLayer(*m_clipLayer->platformLayer());
- m_layerTreeView->registerViewportLayers(
- m_clipLayer->platformLayer(), m_graphicsLayer->platformLayer(), 0);
- m_layerTreeView->setViewportSize(WebSize(1, 1), WebSize(1, 1));
- }
-
- virtual ~GraphicsLayerTest()
- {
- m_graphicsLayer.clear();
- m_layerTreeView.clear();
- }
-
-protected:
- WebLayer* m_platformLayer;
- OwnPtr<GraphicsLayerForTesting> m_graphicsLayer;
- OwnPtr<GraphicsLayerForTesting> m_clipLayer;
-
-private:
- OwnPtr<WebLayerTreeView> m_layerTreeView;
- MockGraphicsLayerClient m_client;
-};
-
-TEST_F(GraphicsLayerTest, updateLayerShouldFlattenTransformWithAnimations)
-{
- ASSERT_FALSE(m_platformLayer->hasActiveAnimation());
-
- OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(Platform::current()->compositorSupport()->createFloatAnimationCurve());
- curve->add(WebFloatKeyframe(0.0, 0.0));
- OwnPtr<WebAnimation> floatAnimation(adoptPtr(Platform::current()->compositorSupport()->createAnimation(*curve, WebAnimation::TargetPropertyOpacity)));
- int animationId = floatAnimation->id();
- ASSERT_TRUE(m_platformLayer->addAnimation(floatAnimation.leakPtr()));
-
- ASSERT_TRUE(m_platformLayer->hasActiveAnimation());
-
- m_graphicsLayer->setShouldFlattenTransform(false);
-
- m_platformLayer = m_graphicsLayer->platformLayer();
- ASSERT_TRUE(m_platformLayer);
-
- ASSERT_TRUE(m_platformLayer->hasActiveAnimation());
- m_platformLayer->removeAnimation(animationId);
- ASSERT_FALSE(m_platformLayer->hasActiveAnimation());
-
- m_graphicsLayer->setShouldFlattenTransform(true);
-
- m_platformLayer = m_graphicsLayer->platformLayer();
- ASSERT_TRUE(m_platformLayer);
-
- ASSERT_FALSE(m_platformLayer->hasActiveAnimation());
-}
-
-class FakeScrollableArea : public ScrollableArea {
-public:
- virtual bool isActive() const OVERRIDE { return false; }
- virtual int scrollSize(ScrollbarOrientation) const OVERRIDE { return 100; }
- virtual bool isScrollCornerVisible() const OVERRIDE { return false; }
- virtual IntRect scrollCornerRect() const OVERRIDE { return IntRect(); }
- virtual int visibleWidth() const OVERRIDE { return 10; }
- virtual int visibleHeight() const OVERRIDE { return 10; }
- virtual IntSize contentsSize() const OVERRIDE { return IntSize(100, 100); }
- virtual bool scrollbarsCanBeActive() const OVERRIDE { return false; }
- virtual IntRect scrollableAreaBoundingBox() const OVERRIDE { return IntRect(); }
- virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) OVERRIDE { }
- virtual void invalidateScrollCornerRect(const IntRect&) OVERRIDE { }
- virtual bool userInputScrollable(ScrollbarOrientation) const OVERRIDE { return true; }
- virtual bool shouldPlaceVerticalScrollbarOnLeft() const OVERRIDE { return false; }
- virtual int pageStep(ScrollbarOrientation) const OVERRIDE { return 0; }
- virtual IntPoint minimumScrollPosition() const OVERRIDE { return IntPoint(); }
- virtual IntPoint maximumScrollPosition() const OVERRIDE
- {
- return IntPoint(contentsSize().width() - visibleWidth(), contentsSize().height() - visibleHeight());
- }
-
- virtual void setScrollOffset(const IntPoint& scrollOffset) OVERRIDE { m_scrollPosition = scrollOffset; }
- virtual IntPoint scrollPosition() const OVERRIDE { return m_scrollPosition; }
-
-private:
- IntPoint m_scrollPosition;
-};
-
-TEST_F(GraphicsLayerTest, applyScrollToScrollableArea)
-{
- FakeScrollableArea scrollableArea;
- m_graphicsLayer->setScrollableArea(&scrollableArea, false);
-
- WebPoint scrollPosition(7, 9);
- m_platformLayer->setScrollPosition(scrollPosition);
- m_graphicsLayer->didScroll();
-
- EXPECT_EQ(scrollPosition, WebPoint(scrollableArea.scrollPosition()));
-}
-
-} // namespace
diff --git a/Source/web/tests/ImageFilterBuilderTest.cpp b/Source/web/tests/ImageFilterBuilderTest.cpp
deleted file mode 100644
index 3d29816..0000000
--- a/Source/web/tests/ImageFilterBuilderTest.cpp
+++ /dev/null
@@ -1,125 +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 "SkImageFilter.h"
-#include "platform/graphics/filters/FEBlend.h"
-#include "platform/graphics/filters/FEGaussianBlur.h"
-#include "platform/graphics/filters/FEMerge.h"
-#include "platform/graphics/filters/FilterOperations.h"
-#include "platform/graphics/filters/ReferenceFilter.h"
-#include "platform/graphics/filters/SourceGraphic.h"
-#include "platform/graphics/filters/SkiaImageFilterBuilder.h"
-#include <gtest/gtest.h>
-
-using testing::Test;
-using namespace WebCore;
-
-class ImageFilterBuilderTest : public Test {
-protected:
- void colorSpaceTest()
- {
- // Build filter tree
- RefPtr<ReferenceFilter> referenceFilter = ReferenceFilter::create();
-
- // Add a dummy source graphic input
- RefPtr<FilterEffect> sourceEffect = referenceFilter->sourceGraphic();
- sourceEffect->setOperatingColorSpace(ColorSpaceDeviceRGB);
-
- // Add a blur effect (with input : source)
- RefPtr<FilterEffect> blurEffect =
- FEGaussianBlur::create(referenceFilter.get(), 3.0f, 3.0f);
- blurEffect->setOperatingColorSpace(ColorSpaceLinearRGB);
- blurEffect->inputEffects().append(sourceEffect);
-
- // Add a blend effect (with inputs : blur, source)
- RefPtr<FilterEffect> blendEffect =
- FEBlend::create(referenceFilter.get(), FEBLEND_MODE_NORMAL);
- blendEffect->setOperatingColorSpace(ColorSpaceDeviceRGB);
- FilterEffectVector& blendInputs = blendEffect->inputEffects();
- blendInputs.reserveCapacity(2);
- blendInputs.append(sourceEffect);
- blendInputs.append(blurEffect);
-
- // Add a merge effect (with inputs : blur, blend)
- RefPtr<FilterEffect> mergeEffect = FEMerge::create(referenceFilter.get());
- mergeEffect->setOperatingColorSpace(ColorSpaceLinearRGB);
- FilterEffectVector& mergeInputs = mergeEffect->inputEffects();
- mergeInputs.reserveCapacity(2);
- mergeInputs.append(blurEffect);
- mergeInputs.append(blendEffect);
- referenceFilter->setLastEffect(mergeEffect);
-
- // Get SkImageFilter resulting tree
- SkiaImageFilterBuilder builder;
- RefPtr<SkImageFilter> filter = builder.build(referenceFilter->lastEffect(), ColorSpaceDeviceRGB);
-
- // Let's check that the resulting tree looks like this :
- // ColorSpace (Linear->Device) : CS (L->D)
- // |
- // Merge (L)
- // | |
- // | CS (D->L)
- // | |
- // | Blend (D)
- // | / |
- // | CS (L->D) |
- // | / |
- // Blur (L) |
- // \ |
- // CS (D->L) |
- // \ |
- // Source Graphic (D)
-
- EXPECT_EQ(filter->countInputs(), 1); // Should be CS (L->D)
- SkImageFilter* child = filter->getInput(0); // Should be Merge
- EXPECT_EQ(child->asColorFilter(0), false);
- EXPECT_EQ(child->countInputs(), 2);
- child = child->getInput(1); // Should be CS (D->L)
- EXPECT_EQ(child->asColorFilter(0), true);
- EXPECT_EQ(child->countInputs(), 1);
- child = child->getInput(0); // Should be Blend
- EXPECT_EQ(child->asColorFilter(0), false);
- EXPECT_EQ(child->countInputs(), 2);
- child = child->getInput(0); // Should be CS (L->D)
- EXPECT_EQ(child->asColorFilter(0), true);
- EXPECT_EQ(child->countInputs(), 1);
- child = child->getInput(0); // Should be Blur
- EXPECT_EQ(child->asColorFilter(0), false);
- EXPECT_EQ(child->countInputs(), 1);
- child = child->getInput(0); // Should be CS (D->L)
- EXPECT_EQ(child->asColorFilter(0), true);
- EXPECT_EQ(child->countInputs(), 1);
- }
-};
-
-namespace {
-
-TEST_F(ImageFilterBuilderTest, testColorSpace)
-{
- colorSpaceTest();
-}
-
-} // namespace
diff --git a/Source/web/tests/ImageLayerChromiumTest.cpp b/Source/web/tests/ImageLayerChromiumTest.cpp
deleted file mode 100644
index 66f0864..0000000
--- a/Source/web/tests/ImageLayerChromiumTest.cpp
+++ /dev/null
@@ -1,128 +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:
- * 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 <gtest/gtest.h>
-#include "platform/graphics/GraphicsLayer.h"
-#include "platform/graphics/Image.h"
-#include "platform/graphics/skia/NativeImageSkia.h"
-#include "public/platform/WebImageLayer.h"
-#include "wtf/PassOwnPtr.h"
-
-using namespace WebCore;
-
-namespace {
-
-class MockGraphicsLayerClient : public GraphicsLayerClient {
- public:
- virtual void notifyAnimationStarted(const GraphicsLayer*, double monotonicTime) OVERRIDE { }
- virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& inClip) OVERRIDE { }
- virtual String debugName(const GraphicsLayer*) OVERRIDE { return String(); }
-};
-
-class TestImage : public Image {
-public:
-
- static PassRefPtr<TestImage> create(const IntSize& size, bool isOpaque)
- {
- return adoptRef(new TestImage(size, isOpaque));
- }
-
- explicit TestImage(const IntSize& size, bool isOpaque)
- : Image(0)
- , m_size(size)
- {
- m_nativeImage = NativeImageSkia::create();
- EXPECT_TRUE(m_nativeImage->bitmap().allocN32Pixels(size.width(), size.height(), isOpaque));
- }
-
- virtual bool isBitmapImage() const OVERRIDE
- {
- return true;
- }
-
- virtual bool currentFrameKnownToBeOpaque() OVERRIDE
- {
- return m_nativeImage->bitmap().isOpaque();
- }
-
- virtual IntSize size() const OVERRIDE
- {
- return m_size;
- }
-
- virtual PassRefPtr<NativeImageSkia> nativeImageForCurrentFrame() OVERRIDE
- {
- if (m_size.isZero())
- return nullptr;
-
- return m_nativeImage;
- }
-
- // Stub implementations of pure virtual Image functions.
- virtual void destroyDecodedData(bool) OVERRIDE
- {
- }
-
- virtual void draw(GraphicsContext*, const FloatRect&, const FloatRect&, CompositeOperator, blink::WebBlendMode) OVERRIDE
- {
- }
-
-private:
-
- IntSize m_size;
-
- RefPtr<NativeImageSkia> m_nativeImage;
-};
-
-class GraphicsLayerForTesting : public GraphicsLayer {
-public:
- explicit GraphicsLayerForTesting(GraphicsLayerClient* client)
- : GraphicsLayer(client) { };
-
- virtual blink::WebLayer* contentsLayer() const { return GraphicsLayer::contentsLayer(); }
-};
-
-TEST(ImageLayerChromiumTest, opaqueImages)
-{
- MockGraphicsLayerClient client;
- OwnPtr<GraphicsLayerForTesting> graphicsLayer = adoptPtr(new GraphicsLayerForTesting(&client));
- ASSERT_TRUE(graphicsLayer.get());
-
- RefPtr<Image> opaqueImage = TestImage::create(IntSize(100, 100), true /* opaque */);
- ASSERT_TRUE(opaqueImage.get());
- RefPtr<Image> nonOpaqueImage = TestImage::create(IntSize(100, 100), false /* opaque */);
- ASSERT_TRUE(nonOpaqueImage.get());
-
- ASSERT_FALSE(graphicsLayer->contentsLayer());
-
- graphicsLayer->setContentsToImage(opaqueImage.get());
- ASSERT_TRUE(graphicsLayer->contentsLayer()->opaque());
-
- graphicsLayer->setContentsToImage(nonOpaqueImage.get());
- ASSERT_FALSE(graphicsLayer->contentsLayer()->opaque());
-}
-
-} // namespace
diff --git a/Source/web/tests/OpaqueRectTrackingContentLayerDelegateTest.cpp b/Source/web/tests/OpaqueRectTrackingContentLayerDelegateTest.cpp
deleted file mode 100644
index f1a8949..0000000
--- a/Source/web/tests/OpaqueRectTrackingContentLayerDelegateTest.cpp
+++ /dev/null
@@ -1,197 +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 "platform/graphics/OpaqueRectTrackingContentLayerDelegate.h"
-
-#include "platform/geometry/IntRect.h"
-#include "platform/graphics/Color.h"
-#include "platform/graphics/GraphicsContext.h"
-#include "skia/ext/platform_canvas.h"
-#include "public/platform/WebFloatRect.h"
-#include "public/platform/WebRect.h"
-
-#include <gtest/gtest.h>
-
-using blink::WebRect;
-using blink::WebFloatRect;
-using namespace WebCore;
-
-namespace {
-
-struct PaintCallback {
- virtual void operator()(GraphicsContext&, const IntRect&) = 0;
-};
-
-class TestLayerPainterChromium : public GraphicsContextPainter {
-public:
- TestLayerPainterChromium(PaintCallback& callback) : m_callback(callback) { }
-
- virtual void paint(GraphicsContext& context, const IntRect& contentRect) OVERRIDE
- {
- m_callback(context, contentRect);
- }
-
- private:
- PaintCallback& m_callback;
-};
-
-// Paint callback functions
-
-struct PaintFillOpaque : public PaintCallback {
- virtual void operator()(GraphicsContext& context, const IntRect& contentRect) OVERRIDE
- {
- Color opaque(255, 0, 0, 255);
- IntRect top(contentRect.x(), contentRect.y(), contentRect.width(), contentRect.height() / 2);
- IntRect bottom(contentRect.x(), contentRect.y() + contentRect.height() / 2, contentRect.width(), contentRect.height() / 2);
- context.fillRect(top, opaque);
- context.fillRect(bottom, opaque);
- }
-};
-
-struct PaintFillAlpha : public PaintCallback {
- virtual void operator()(GraphicsContext& context, const IntRect& contentRect)
- {
- Color alpha(0, 0, 0, 0);
- context.fillRect(contentRect, alpha);
- }
-};
-
-struct PaintFillPartialOpaque : public PaintCallback {
- PaintFillPartialOpaque(IntRect opaqueRect)
- : m_opaqueRect(opaqueRect)
- {
- }
-
- virtual void operator()(GraphicsContext& context, const IntRect& contentRect)
- {
- Color alpha(0, 0, 0, 0);
- context.fillRect(contentRect, alpha);
-
- IntRect fillOpaque = m_opaqueRect;
- fillOpaque.intersect(contentRect);
-
- Color opaque(255, 255, 255, 255);
- context.fillRect(fillOpaque, opaque);
- }
-
- IntRect m_opaqueRect;
-};
-
-#define EXPECT_EQ_RECT(a, b) \
- EXPECT_EQ(a.x, b.x); \
- EXPECT_EQ(a.width, b.width); \
- EXPECT_EQ(a.y, b.y); \
- EXPECT_EQ(a.height, b.height);
-
-class OpaqueRectTrackingContentLayerDelegateTest : public testing::Test {
-public:
- OpaqueRectTrackingContentLayerDelegateTest()
- : m_skCanvas(adoptPtr(skia::CreateBitmapCanvas(canvasRect().width, canvasRect().height, false)))
- {
- }
-
- SkCanvas* skCanvas() { return m_skCanvas.get(); }
- WebRect canvasRect() { return WebRect(0, 0, 400, 400); }
-
-private:
- OwnPtr<SkCanvas> m_skCanvas;
-};
-
-TEST_F(OpaqueRectTrackingContentLayerDelegateTest, testOpaqueRectPresentAfterOpaquePaint)
-{
- PaintFillOpaque fillOpaque;
- TestLayerPainterChromium painter(fillOpaque);
-
- OpaqueRectTrackingContentLayerDelegate delegate(&painter);
-
- WebFloatRect opaqueRect;
- delegate.paintContents(skCanvas(), canvasRect(), false, opaqueRect);
- EXPECT_EQ_RECT(WebFloatRect(0, 0, 400, 400), opaqueRect);
-}
-
-TEST_F(OpaqueRectTrackingContentLayerDelegateTest, testOpaqueRectNotPresentAfterNonOpaquePaint)
-{
- PaintFillAlpha fillAlpha;
- TestLayerPainterChromium painter(fillAlpha);
- OpaqueRectTrackingContentLayerDelegate delegate(&painter);
-
- WebFloatRect opaqueRect;
- delegate.paintContents(skCanvas(), canvasRect(), false, opaqueRect);
- EXPECT_EQ_RECT(WebFloatRect(0, 0, 0, 0), opaqueRect);
-}
-
-TEST_F(OpaqueRectTrackingContentLayerDelegateTest, testOpaqueRectNotPresentForOpaqueLayerWithOpaquePaint)
-{
- PaintFillOpaque fillOpaque;
- TestLayerPainterChromium painter(fillOpaque);
- OpaqueRectTrackingContentLayerDelegate delegate(&painter);
-
- delegate.setOpaque(true);
-
- WebFloatRect opaqueRect;
- delegate.paintContents(skCanvas(), canvasRect(), false, opaqueRect);
- EXPECT_EQ_RECT(WebFloatRect(0, 0, 0, 0), opaqueRect);
-}
-
-TEST_F(OpaqueRectTrackingContentLayerDelegateTest, testOpaqueRectNotPresentForOpaqueLayerWithNonOpaquePaint)
-{
- PaintFillOpaque fillAlpha;
- TestLayerPainterChromium painter(fillAlpha);
- OpaqueRectTrackingContentLayerDelegate delegate(&painter);
-
- delegate.setOpaque(true);
-
- WebFloatRect opaqueRect;
- delegate.paintContents(skCanvas(), canvasRect(), false, opaqueRect);
- EXPECT_EQ_RECT(WebFloatRect(0, 0, 0, 0), opaqueRect);
-}
-
-TEST_F(OpaqueRectTrackingContentLayerDelegateTest, testPartialOpaqueRectNoTransform)
-{
- IntRect partialRect(100, 200, 50, 75);
- PaintFillPartialOpaque fillPartial(partialRect);
- TestLayerPainterChromium painter(fillPartial);
- OpaqueRectTrackingContentLayerDelegate delegate(&painter);
-
- WebFloatRect opaqueRect;
- delegate.paintContents(skCanvas(), canvasRect(), false, opaqueRect);
- EXPECT_EQ_RECT(WebFloatRect(partialRect.x(), partialRect.y(), partialRect.width(), partialRect.height()), opaqueRect);
-}
-
-TEST_F(OpaqueRectTrackingContentLayerDelegateTest, testPartialOpaqueRectTranslation)
-{
- IntRect partialRect(100, 200, 50, 75);
- PaintFillPartialOpaque fillPartial(partialRect);
- TestLayerPainterChromium painter(fillPartial);
- OpaqueRectTrackingContentLayerDelegate delegate(&painter);
-
- WebFloatRect opaqueRect;
- WebRect contentRect(11, 12, 389, 388);
- delegate.paintContents(skCanvas(), contentRect, false, opaqueRect);
- EXPECT_EQ_RECT(WebFloatRect(partialRect.x(), partialRect.y(), partialRect.width(), partialRect.height()), opaqueRect);
-}
-
-} // namespace
diff --git a/Source/web/tests/ScrollingCoordinatorChromiumTest.cpp b/Source/web/tests/ScrollingCoordinatorChromiumTest.cpp
index 9e10eaa..e15ca9f 100644
--- a/Source/web/tests/ScrollingCoordinatorChromiumTest.cpp
+++ b/Source/web/tests/ScrollingCoordinatorChromiumTest.cpp
@@ -460,7 +460,6 @@
int expectedScrollPosition = 958 + (innerFrameView->verticalScrollbar()->isOverlayScrollbar() ? 0 : 15);
ASSERT_EQ(expectedScrollPosition, webScrollLayer->scrollPosition().x);
- ASSERT_EQ(expectedScrollPosition, webScrollLayer->maxScrollPosition().width);
}
TEST_F(ScrollingCoordinatorChromiumTest, setupScrollbarLayerShouldNotCrash)
diff --git a/Source/web/tests/ViewportTest.cpp b/Source/web/tests/ViewportTest.cpp
index 3ad4aee..36c0e04 100644
--- a/Source/web/tests/ViewportTest.cpp
+++ b/Source/web/tests/ViewportTest.cpp
@@ -37,12 +37,13 @@
#include "WebScriptSource.h"
#include "WebSettings.h"
#include "WebViewClient.h"
-#include "core/dom/ViewportDescription.h"
#include "core/frame/FrameView.h"
#include "core/frame/LocalFrame.h"
+#include "core/page/InjectedStyleSheets.h"
#include "core/page/Page.h"
#include "core/page/PageScaleConstraints.h"
#include "core/frame/Settings.h"
+#include "platform/Length.h"
#include "platform/geometry/IntPoint.h"
#include "platform/geometry/IntRect.h"
#include "platform/geometry/IntSize.h"
@@ -127,9 +128,8 @@
{
IntSize initialViewportSize(initialWidth, initialHeight);
page->mainFrame()->view()->setFrameRect(IntRect(IntPoint::zero(), initialViewportSize));
-
ViewportDescription description = page->viewportDescription();
- PageScaleConstraints constraints = description.resolve(initialViewportSize);
+ PageScaleConstraints constraints = description.resolve(initialViewportSize, WebCore::Length(980, WebCore::Fixed));
constraints.fitToContentsWidth(constraints.layoutSize.width(), initialWidth);
return constraints;
diff --git a/Source/web/tests/WEBPImageDecoderTest.cpp b/Source/web/tests/WEBPImageDecoderTest.cpp
deleted file mode 100644
index a49917b..0000000
--- a/Source/web/tests/WEBPImageDecoderTest.cpp
+++ /dev/null
@@ -1,596 +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 "platform/image-decoders/webp/WEBPImageDecoder.h"
-
-#include "RuntimeEnabledFeatures.h"
-#include "platform/SharedBuffer.h"
-#include "public/platform/Platform.h"
-#include "public/platform/WebData.h"
-#include "public/platform/WebSize.h"
-#include "public/platform/WebUnitTestSupport.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/PassOwnPtr.h"
-#include "wtf/StringHasher.h"
-#include "wtf/Vector.h"
-#include "wtf/dtoa/utils.h"
-#include <gtest/gtest.h>
-
-using namespace WebCore;
-using namespace blink;
-
-namespace {
-
-PassRefPtr<SharedBuffer> readFile(const char* fileName)
-{
- String filePath = Platform::current()->unitTestSupport()->webKitRootDir();
- filePath.append(fileName);
-
- return Platform::current()->unitTestSupport()->readFromFile(filePath);
-}
-
-PassOwnPtr<WEBPImageDecoder> createDecoder()
-{
- return adoptPtr(new WEBPImageDecoder(ImageSource::AlphaNotPremultiplied, ImageSource::GammaAndColorProfileApplied, ImageDecoder::noDecodedImageByteLimit));
-}
-
-unsigned hashSkBitmap(const SkBitmap& bitmap)
-{
- return StringHasher::hashMemory(bitmap.getPixels(), bitmap.getSize());
-}
-
-void createDecodingBaseline(SharedBuffer* data, Vector<unsigned>* baselineHashes)
-{
- OwnPtr<WEBPImageDecoder> decoder = createDecoder();
- decoder->setData(data, true);
- size_t frameCount = decoder->frameCount();
- for (size_t i = 0; i < frameCount; ++i) {
- ImageFrame* frame = decoder->frameBufferAtIndex(i);
- baselineHashes->append(hashSkBitmap(frame->getSkBitmap()));
- }
-}
-
-void testRandomFrameDecode(const char* webpFile)
-{
- SCOPED_TRACE(webpFile);
-
- RefPtr<SharedBuffer> fullData = readFile(webpFile);
- ASSERT_TRUE(fullData.get());
- Vector<unsigned> baselineHashes;
- createDecodingBaseline(fullData.get(), &baselineHashes);
- size_t frameCount = baselineHashes.size();
-
- // Random decoding should get the same results as sequential decoding.
- OwnPtr<WEBPImageDecoder> decoder = createDecoder();
- decoder->setData(fullData.get(), true);
- const size_t skippingStep = 5;
- for (size_t i = 0; i < skippingStep; ++i) {
- for (size_t j = i; j < frameCount; j += skippingStep) {
- SCOPED_TRACE(testing::Message() << "Random i:" << i << " j:" << j);
- ImageFrame* frame = decoder->frameBufferAtIndex(j);
- EXPECT_EQ(baselineHashes[j], hashSkBitmap(frame->getSkBitmap()));
- }
- }
-
- // Decoding in reverse order.
- decoder = createDecoder();
- decoder->setData(fullData.get(), true);
- for (size_t i = frameCount; i; --i) {
- SCOPED_TRACE(testing::Message() << "Reverse i:" << i);
- ImageFrame* frame = decoder->frameBufferAtIndex(i - 1);
- EXPECT_EQ(baselineHashes[i - 1], hashSkBitmap(frame->getSkBitmap()));
- }
-}
-
-void testRandomDecodeAfterClearFrameBufferCache(const char* webpFile)
-{
- SCOPED_TRACE(webpFile);
-
- RefPtr<SharedBuffer> data = readFile(webpFile);
- ASSERT_TRUE(data.get());
- Vector<unsigned> baselineHashes;
- createDecodingBaseline(data.get(), &baselineHashes);
- size_t frameCount = baselineHashes.size();
-
- OwnPtr<WEBPImageDecoder> decoder = createDecoder();
- decoder->setData(data.get(), true);
- for (size_t clearExceptFrame = 0; clearExceptFrame < frameCount; ++clearExceptFrame) {
- decoder->clearCacheExceptFrame(clearExceptFrame);
- const size_t skippingStep = 5;
- for (size_t i = 0; i < skippingStep; ++i) {
- for (size_t j = 0; j < frameCount; j += skippingStep) {
- SCOPED_TRACE(testing::Message() << "Random i:" << i << " j:" << j);
- ImageFrame* frame = decoder->frameBufferAtIndex(j);
- EXPECT_EQ(baselineHashes[j], hashSkBitmap(frame->getSkBitmap()));
- }
- }
- }
-}
-
-void testDecodeAfterReallocatingData(const char* webpFile)
-{
- OwnPtr<WEBPImageDecoder> decoder = createDecoder();
- RefPtr<SharedBuffer> data = readFile(webpFile);
- ASSERT_TRUE(data.get());
-
- // Parse from 'data'.
- decoder->setData(data.get(), true);
- size_t frameCount = decoder->frameCount();
-
- // ... and then decode frames from 'reallocatedData'.
- RefPtr<SharedBuffer> reallocatedData = data.get()->copy();
- ASSERT_TRUE(reallocatedData.get());
- data.clear();
- decoder->setData(reallocatedData.get(), true);
-
- for (size_t i = 0; i < frameCount; ++i) {
- const ImageFrame* const frame = decoder->frameBufferAtIndex(i);
- EXPECT_EQ(ImageFrame::FrameComplete, frame->status());
- }
-}
-
-// If 'parseErrorExpected' is true, error is expected during parse (frameCount()
-// call); else error is expected during decode (frameBufferAtIndex() call).
-void testInvalidImage(const char* webpFile, bool parseErrorExpected)
-{
- OwnPtr<WEBPImageDecoder> decoder = createDecoder();
-
- RefPtr<SharedBuffer> data = readFile(webpFile);
- ASSERT_TRUE(data.get());
- decoder->setData(data.get(), true);
-
- if (parseErrorExpected)
- EXPECT_EQ(0u, decoder->frameCount());
- else
- EXPECT_LT(0u, decoder->frameCount());
- ImageFrame* frame = decoder->frameBufferAtIndex(0);
- EXPECT_FALSE(frame);
- EXPECT_EQ(cAnimationLoopOnce, decoder->repetitionCount());
-}
-
-} // namespace
-
-TEST(AnimatedWebPTests, uniqueGenerationIDs)
-{
- OwnPtr<WEBPImageDecoder> decoder = createDecoder();
-
- RefPtr<SharedBuffer> data = readFile("/LayoutTests/fast/images/resources/webp-animated.webp");
- ASSERT_TRUE(data.get());
- decoder->setData(data.get(), true);
-
- ImageFrame* frame = decoder->frameBufferAtIndex(0);
- uint32_t generationID0 = frame->getSkBitmap().getGenerationID();
- frame = decoder->frameBufferAtIndex(1);
- uint32_t generationID1 = frame->getSkBitmap().getGenerationID();
-
- EXPECT_TRUE(generationID0 != generationID1);
-}
-
-TEST(AnimatedWebPTests, verifyAnimationParametersTransparentImage)
-{
- OwnPtr<WEBPImageDecoder> decoder = createDecoder();
- EXPECT_EQ(cAnimationLoopOnce, decoder->repetitionCount());
-
- RefPtr<SharedBuffer> data = readFile("/LayoutTests/fast/images/resources/webp-animated.webp");
- ASSERT_TRUE(data.get());
- decoder->setData(data.get(), true);
-
- const int canvasWidth = 11;
- const int canvasHeight = 29;
- const struct AnimParam {
- int xOffset, yOffset, width, height;
- ImageFrame::DisposalMethod disposalMethod;
- ImageFrame::AlphaBlendSource alphaBlendSource;
- unsigned duration;
- bool hasAlpha;
- } frameParameters[] = {
- { 0, 0, 11, 29, ImageFrame::DisposeKeep, ImageFrame::BlendAtopPreviousFrame, 1000u, true },
- { 2, 10, 7, 17, ImageFrame::DisposeKeep, ImageFrame::BlendAtopPreviousFrame, 500u, true },
- { 2, 2, 7, 16, ImageFrame::DisposeKeep, ImageFrame::BlendAtopPreviousFrame, 1000u, true },
- };
-
- for (size_t i = 0; i < ARRAY_SIZE(frameParameters); ++i) {
- const ImageFrame* const frame = decoder->frameBufferAtIndex(i);
- EXPECT_EQ(ImageFrame::FrameComplete, frame->status());
- EXPECT_EQ(canvasWidth, frame->getSkBitmap().width());
- EXPECT_EQ(canvasHeight, frame->getSkBitmap().height());
- EXPECT_EQ(frameParameters[i].xOffset, frame->originalFrameRect().x());
- EXPECT_EQ(frameParameters[i].yOffset, frame->originalFrameRect().y());
- EXPECT_EQ(frameParameters[i].width, frame->originalFrameRect().width());
- EXPECT_EQ(frameParameters[i].height, frame->originalFrameRect().height());
- EXPECT_EQ(frameParameters[i].disposalMethod, frame->disposalMethod());
- EXPECT_EQ(frameParameters[i].alphaBlendSource, frame->alphaBlendSource());
- EXPECT_EQ(frameParameters[i].duration, frame->duration());
- EXPECT_EQ(frameParameters[i].hasAlpha, frame->hasAlpha());
- }
-
- EXPECT_EQ(ARRAY_SIZE(frameParameters), decoder->frameCount());
- EXPECT_EQ(cAnimationLoopInfinite, decoder->repetitionCount());
-}
-
-TEST(AnimatedWebPTests, verifyAnimationParametersOpaqueFramesTransparentBackground)
-{
- OwnPtr<WEBPImageDecoder> decoder = createDecoder();
- EXPECT_EQ(cAnimationLoopOnce, decoder->repetitionCount());
-
- RefPtr<SharedBuffer> data = readFile("/LayoutTests/fast/images/resources/webp-animated-opaque.webp");
- ASSERT_TRUE(data.get());
- decoder->setData(data.get(), true);
-
- const int canvasWidth = 94;
- const int canvasHeight = 87;
- const struct AnimParam {
- int xOffset, yOffset, width, height;
- ImageFrame::DisposalMethod disposalMethod;
- ImageFrame::AlphaBlendSource alphaBlendSource;
- unsigned duration;
- bool hasAlpha;
- } frameParameters[] = {
- { 4, 10, 33, 32, ImageFrame::DisposeOverwriteBgcolor, ImageFrame::BlendAtopPreviousFrame, 1000u, true },
- { 34, 30, 33, 32, ImageFrame::DisposeOverwriteBgcolor, ImageFrame::BlendAtopPreviousFrame, 1000u, true },
- { 62, 50, 32, 32, ImageFrame::DisposeOverwriteBgcolor, ImageFrame::BlendAtopPreviousFrame, 1000u, true },
- { 10, 54, 32, 33, ImageFrame::DisposeOverwriteBgcolor, ImageFrame::BlendAtopPreviousFrame, 1000u, true },
- };
-
- for (size_t i = 0; i < ARRAY_SIZE(frameParameters); ++i) {
- const ImageFrame* const frame = decoder->frameBufferAtIndex(i);
- EXPECT_EQ(ImageFrame::FrameComplete, frame->status());
- EXPECT_EQ(canvasWidth, frame->getSkBitmap().width());
- EXPECT_EQ(canvasHeight, frame->getSkBitmap().height());
- EXPECT_EQ(frameParameters[i].xOffset, frame->originalFrameRect().x());
- EXPECT_EQ(frameParameters[i].yOffset, frame->originalFrameRect().y());
- EXPECT_EQ(frameParameters[i].width, frame->originalFrameRect().width());
- EXPECT_EQ(frameParameters[i].height, frame->originalFrameRect().height());
- EXPECT_EQ(frameParameters[i].disposalMethod, frame->disposalMethod());
- EXPECT_EQ(frameParameters[i].alphaBlendSource, frame->alphaBlendSource());
- EXPECT_EQ(frameParameters[i].duration, frame->duration());
- EXPECT_EQ(frameParameters[i].hasAlpha, frame->hasAlpha());
- }
-
- EXPECT_EQ(ARRAY_SIZE(frameParameters), decoder->frameCount());
- EXPECT_EQ(cAnimationLoopInfinite, decoder->repetitionCount());
-}
-
-TEST(AnimatedWebPTests, verifyAnimationParametersBlendOverwrite)
-{
- OwnPtr<WEBPImageDecoder> decoder = createDecoder();
- EXPECT_EQ(cAnimationLoopOnce, decoder->repetitionCount());
-
- RefPtr<SharedBuffer> data = readFile("/LayoutTests/fast/images/resources/webp-animated-no-blend.webp");
- ASSERT_TRUE(data.get());
- decoder->setData(data.get(), true);
-
- const int canvasWidth = 94;
- const int canvasHeight = 87;
- const struct AnimParam {
- int xOffset, yOffset, width, height;
- ImageFrame::DisposalMethod disposalMethod;
- ImageFrame::AlphaBlendSource alphaBlendSource;
- unsigned duration;
- bool hasAlpha;
- } frameParameters[] = {
- { 4, 10, 33, 32, ImageFrame::DisposeOverwriteBgcolor, ImageFrame::BlendAtopBgcolor, 1000u, true },
- { 34, 30, 33, 32, ImageFrame::DisposeOverwriteBgcolor, ImageFrame::BlendAtopBgcolor, 1000u, true },
- { 62, 50, 32, 32, ImageFrame::DisposeOverwriteBgcolor, ImageFrame::BlendAtopBgcolor, 1000u, true },
- { 10, 54, 32, 33, ImageFrame::DisposeOverwriteBgcolor, ImageFrame::BlendAtopBgcolor, 1000u, true },
- };
-
- for (size_t i = 0; i < ARRAY_SIZE(frameParameters); ++i) {
- const ImageFrame* const frame = decoder->frameBufferAtIndex(i);
- EXPECT_EQ(ImageFrame::FrameComplete, frame->status());
- EXPECT_EQ(canvasWidth, frame->getSkBitmap().width());
- EXPECT_EQ(canvasHeight, frame->getSkBitmap().height());
- EXPECT_EQ(frameParameters[i].xOffset, frame->originalFrameRect().x());
- EXPECT_EQ(frameParameters[i].yOffset, frame->originalFrameRect().y());
- EXPECT_EQ(frameParameters[i].width, frame->originalFrameRect().width());
- EXPECT_EQ(frameParameters[i].height, frame->originalFrameRect().height());
- EXPECT_EQ(frameParameters[i].disposalMethod, frame->disposalMethod());
- EXPECT_EQ(frameParameters[i].alphaBlendSource, frame->alphaBlendSource());
- EXPECT_EQ(frameParameters[i].duration, frame->duration());
- EXPECT_EQ(frameParameters[i].hasAlpha, frame->hasAlpha());
- }
-
- EXPECT_EQ(ARRAY_SIZE(frameParameters), decoder->frameCount());
- EXPECT_EQ(cAnimationLoopInfinite, decoder->repetitionCount());
-}
-
-TEST(AnimatedWebPTests, parseAndDecodeByteByByte)
-{
- const struct TestImage {
- const char* filename;
- unsigned frameCount;
- int repetitionCount;
- } testImages[] = {
- { "/LayoutTests/fast/images/resources/webp-animated.webp", 3u, cAnimationLoopInfinite },
- { "/LayoutTests/fast/images/resources/webp-animated-icc-xmp.webp", 13u, 32000 },
- };
-
- for (size_t i = 0; i < ARRAY_SIZE(testImages); ++i) {
- OwnPtr<WEBPImageDecoder> decoder = createDecoder();
- RefPtr<SharedBuffer> data = readFile(testImages[i].filename);
- ASSERT_TRUE(data.get());
-
- size_t frameCount = 0;
- size_t framesDecoded = 0;
-
- // Pass data to decoder byte by byte.
- for (size_t length = 1; length <= data->size(); ++length) {
- RefPtr<SharedBuffer> tempData = SharedBuffer::create(data->data(), length);
- decoder->setData(tempData.get(), length == data->size());
-
- EXPECT_LE(frameCount, decoder->frameCount());
- frameCount = decoder->frameCount();
-
- ImageFrame* frame = decoder->frameBufferAtIndex(frameCount - 1);
- if (frame && frame->status() == ImageFrame::FrameComplete && framesDecoded < frameCount)
- ++framesDecoded;
- }
-
- EXPECT_EQ(testImages[i].frameCount, decoder->frameCount());
- EXPECT_EQ(testImages[i].frameCount, framesDecoded);
- EXPECT_EQ(testImages[i].repetitionCount, decoder->repetitionCount());
- }
-}
-
-TEST(AnimatedWebPTests, invalidImages)
-{
- // ANMF chunk size is smaller than ANMF header size.
- testInvalidImage("/LayoutTests/fast/images/resources/invalid-animated-webp.webp", true);
- // One of the frame rectangles extends outside the image boundary.
- testInvalidImage("/LayoutTests/fast/images/resources/invalid-animated-webp3.webp", true);
-}
-
-TEST(AnimatedWebPTests, truncatedLastFrame)
-{
- OwnPtr<WEBPImageDecoder> decoder = createDecoder();
-
- RefPtr<SharedBuffer> data = readFile("/LayoutTests/fast/images/resources/invalid-animated-webp2.webp");
- ASSERT_TRUE(data.get());
- decoder->setData(data.get(), true);
-
- unsigned frameCount = 8;
- EXPECT_EQ(frameCount, decoder->frameCount());
- ImageFrame* frame = decoder->frameBufferAtIndex(frameCount - 1);
- EXPECT_FALSE(frame);
- frame = decoder->frameBufferAtIndex(0);
- EXPECT_FALSE(frame);
-}
-
-TEST(AnimatedWebPTests, truncatedInBetweenFrame)
-{
- OwnPtr<WEBPImageDecoder> decoder = createDecoder();
-
- RefPtr<SharedBuffer> fullData = readFile("/LayoutTests/fast/images/resources/invalid-animated-webp4.webp");
- ASSERT_TRUE(fullData.get());
- RefPtr<SharedBuffer> data = SharedBuffer::create(fullData->data(), fullData->size() - 1);
- decoder->setData(data.get(), false);
-
- ImageFrame* frame = decoder->frameBufferAtIndex(2);
- EXPECT_FALSE(frame);
-}
-
-// Reproduce a crash that used to happen for a specific file with specific sequence of method calls.
-TEST(AnimatedWebPTests, reproCrash)
-{
- OwnPtr<WEBPImageDecoder> decoder = createDecoder();
-
- RefPtr<SharedBuffer> fullData = readFile("/LayoutTests/fast/images/resources/invalid_vp8_vp8x.webp");
- ASSERT_TRUE(fullData.get());
-
- // Parse partial data up to which error in bitstream is not detected.
- const size_t partialSize = 32768;
- ASSERT_GT(fullData->size(), partialSize);
- RefPtr<SharedBuffer> data = SharedBuffer::create(fullData->data(), partialSize);
- decoder->setData(data.get(), false);
- EXPECT_EQ(1u, decoder->frameCount());
-
- // Parse full data now. The error in bitstream should now be detected.
- decoder->setData(fullData.get(), true);
- EXPECT_EQ(0u, decoder->frameCount());
- ImageFrame* frame = decoder->frameBufferAtIndex(0);
- EXPECT_FALSE(frame);
- EXPECT_EQ(cAnimationLoopOnce, decoder->repetitionCount());
-}
-
-TEST(AnimatedWebPTests, progressiveDecode)
-{
- RefPtr<SharedBuffer> fullData = readFile("/LayoutTests/fast/images/resources/webp-animated.webp");
- ASSERT_TRUE(fullData.get());
- const size_t fullLength = fullData->size();
-
- OwnPtr<WEBPImageDecoder> decoder;
- ImageFrame* frame;
-
- Vector<unsigned> truncatedHashes;
- Vector<unsigned> progressiveHashes;
-
- // Compute hashes when the file is truncated.
- const size_t increment = 1;
- for (size_t i = 1; i <= fullLength; i += increment) {
- decoder = createDecoder();
- RefPtr<SharedBuffer> data = SharedBuffer::create(fullData->data(), i);
- decoder->setData(data.get(), i == fullLength);
- frame = decoder->frameBufferAtIndex(0);
- if (!frame) {
- truncatedHashes.append(0);
- continue;
- }
- truncatedHashes.append(hashSkBitmap(frame->getSkBitmap()));
- }
-
- // Compute hashes when the file is progressively decoded.
- decoder = createDecoder();
- for (size_t i = 1; i <= fullLength; i += increment) {
- RefPtr<SharedBuffer> data = SharedBuffer::create(fullData->data(), i);
- decoder->setData(data.get(), i == fullLength);
- frame = decoder->frameBufferAtIndex(0);
- if (!frame) {
- progressiveHashes.append(0);
- continue;
- }
- progressiveHashes.append(hashSkBitmap(frame->getSkBitmap()));
- }
-
- bool match = true;
- for (size_t i = 0; i < truncatedHashes.size(); ++i) {
- if (truncatedHashes[i] != progressiveHashes[i]) {
- match = false;
- break;
- }
- }
- EXPECT_TRUE(match);
-}
-
-TEST(AnimatedWebPTests, frameIsCompleteAndDuration)
-{
- OwnPtr<WEBPImageDecoder> decoder = createDecoder();
-
- RefPtr<SharedBuffer> data = readFile("/LayoutTests/fast/images/resources/webp-animated.webp");
- ASSERT_TRUE(data.get());
-
- ASSERT_GE(data->size(), 10u);
- RefPtr<SharedBuffer> tempData = SharedBuffer::create(data->data(), data->size() - 10);
- decoder->setData(tempData.get(), false);
-
- EXPECT_EQ(2u, decoder->frameCount());
- EXPECT_FALSE(decoder->failed());
- EXPECT_TRUE(decoder->frameIsCompleteAtIndex(0));
- EXPECT_EQ(1000, decoder->frameDurationAtIndex(0));
- EXPECT_TRUE(decoder->frameIsCompleteAtIndex(1));
- EXPECT_EQ(500, decoder->frameDurationAtIndex(1));
-
- decoder->setData(data.get(), true);
- EXPECT_EQ(3u, decoder->frameCount());
- EXPECT_TRUE(decoder->frameIsCompleteAtIndex(0));
- EXPECT_EQ(1000, decoder->frameDurationAtIndex(0));
- EXPECT_TRUE(decoder->frameIsCompleteAtIndex(1));
- EXPECT_EQ(500, decoder->frameDurationAtIndex(1));
- EXPECT_TRUE(decoder->frameIsCompleteAtIndex(2));
- EXPECT_EQ(1000.0, decoder->frameDurationAtIndex(2));
-}
-
-TEST(AnimatedWebPTests, updateRequiredPreviousFrameAfterFirstDecode)
-{
- OwnPtr<WEBPImageDecoder> decoder = createDecoder();
-
- RefPtr<SharedBuffer> fullData = readFile("/LayoutTests/fast/images/resources/webp-animated.webp");
- ASSERT_TRUE(fullData.get());
-
- // Give it data that is enough to parse but not decode in order to check the status
- // of requiredPreviousFrameIndex before decoding.
- size_t partialSize = 1;
- do {
- RefPtr<SharedBuffer> data = SharedBuffer::create(fullData->data(), partialSize);
- decoder->setData(data.get(), false);
- ++partialSize;
- } while (!decoder->frameCount() || decoder->frameBufferAtIndex(0)->status() == ImageFrame::FrameEmpty);
-
- EXPECT_EQ(kNotFound, decoder->frameBufferAtIndex(0)->requiredPreviousFrameIndex());
- unsigned frameCount = decoder->frameCount();
- for (size_t i = 1; i < frameCount; ++i)
- EXPECT_EQ(i - 1, decoder->frameBufferAtIndex(i)->requiredPreviousFrameIndex());
-
- decoder->setData(fullData.get(), true);
- for (size_t i = 0; i < frameCount; ++i)
- EXPECT_EQ(kNotFound, decoder->frameBufferAtIndex(i)->requiredPreviousFrameIndex());
-}
-
-TEST(AnimatedWebPTests, randomFrameDecode)
-{
- testRandomFrameDecode("/LayoutTests/fast/images/resources/webp-animated.webp");
- testRandomFrameDecode("/LayoutTests/fast/images/resources/webp-animated-opaque.webp");
- testRandomFrameDecode("/LayoutTests/fast/images/resources/webp-animated-large.webp");
- testRandomFrameDecode("/LayoutTests/fast/images/resources/webp-animated-icc-xmp.webp");
-}
-
-TEST(AnimatedWebPTests, randomDecodeAfterClearFrameBufferCache)
-{
- testRandomDecodeAfterClearFrameBufferCache("/LayoutTests/fast/images/resources/webp-animated.webp");
- testRandomDecodeAfterClearFrameBufferCache("/LayoutTests/fast/images/resources/webp-animated-opaque.webp");
- testRandomDecodeAfterClearFrameBufferCache("/LayoutTests/fast/images/resources/webp-animated-large.webp");
- testRandomDecodeAfterClearFrameBufferCache("/LayoutTests/fast/images/resources/webp-animated-icc-xmp.webp");
-}
-
-TEST(AnimatedWebPTests, resumePartialDecodeAfterClearFrameBufferCache)
-{
- RefPtr<SharedBuffer> fullData = readFile("/LayoutTests/fast/images/resources/webp-animated-large.webp");
- ASSERT_TRUE(fullData.get());
- Vector<unsigned> baselineHashes;
- createDecodingBaseline(fullData.get(), &baselineHashes);
- size_t frameCount = baselineHashes.size();
-
- OwnPtr<WEBPImageDecoder> decoder = createDecoder();
-
- // Let frame 0 be partially decoded.
- size_t partialSize = 1;
- do {
- RefPtr<SharedBuffer> data = SharedBuffer::create(fullData->data(), partialSize);
- decoder->setData(data.get(), false);
- ++partialSize;
- } while (!decoder->frameCount() || decoder->frameBufferAtIndex(0)->status() == ImageFrame::FrameEmpty);
-
- // Skip to the last frame and clear.
- decoder->setData(fullData.get(), true);
- EXPECT_EQ(frameCount, decoder->frameCount());
- ImageFrame* lastFrame = decoder->frameBufferAtIndex(frameCount - 1);
- EXPECT_EQ(baselineHashes[frameCount - 1], hashSkBitmap(lastFrame->getSkBitmap()));
- decoder->clearCacheExceptFrame(kNotFound);
-
- // Resume decoding of the first frame.
- ImageFrame* firstFrame = decoder->frameBufferAtIndex(0);
- EXPECT_EQ(ImageFrame::FrameComplete, firstFrame->status());
- EXPECT_EQ(baselineHashes[0], hashSkBitmap(firstFrame->getSkBitmap()));
-}
-
-TEST(AnimatedWebPTests, decodeAfterReallocatingData)
-{
- testDecodeAfterReallocatingData("/LayoutTests/fast/images/resources/webp-animated.webp");
- testDecodeAfterReallocatingData("/LayoutTests/fast/images/resources/webp-animated-icc-xmp.webp");
-}
-
-TEST(StaticWebPTests, truncatedImage)
-{
- // VP8 data is truncated.
- testInvalidImage("/LayoutTests/fast/images/resources/truncated.webp", false);
- // Chunk size in RIFF header doesn't match the file size.
- testInvalidImage("/LayoutTests/fast/images/resources/truncated2.webp", true);
-}
-
-TEST(StaticWebPTests, notAnimated)
-{
- OwnPtr<WEBPImageDecoder> decoder = createDecoder();
- RefPtr<SharedBuffer> data = readFile("/LayoutTests/fast/images/resources/webp-color-profile-lossy.webp");
- ASSERT_TRUE(data.get());
- decoder->setData(data.get(), true);
- EXPECT_EQ(1u, decoder->frameCount());
- EXPECT_EQ(cAnimationNone, decoder->repetitionCount());
-}
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp
index 35500ee..7bc1af9 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -40,6 +40,7 @@
#include "SkBitmap.h"
#include "SkCanvas.h"
#include "URLTestHelpers.h"
+#include "UserAgentStyleSheets.h"
#include "WebDataSource.h"
#include "WebDocument.h"
#include "WebFindOptions.h"
@@ -59,6 +60,8 @@
#include "WebViewClient.h"
#include "WebViewImpl.h"
#include "core/clipboard/Clipboard.h"
+#include "core/css/StyleSheetContents.h"
+#include "core/css/resolver/ViewportStyleResolver.h"
#include "core/dom/DocumentMarkerController.h"
#include "core/dom/FullscreenElementStack.h"
#include "core/dom/Range.h"
@@ -157,6 +160,18 @@
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_chromeURL.c_str()), WebString::fromUTF8(fileName.c_str()));
}
+ void applyViewportStyleOverride(FrameTestHelpers::WebViewHelper* webViewHelper)
+ {
+ RefPtrWillBeRawPtr<WebCore::StyleSheetContents> styleSheet = WebCore::StyleSheetContents::create(WebCore::CSSParserContext(WebCore::UASheetMode, 0));
+ styleSheet->parseString(String(WebCore::viewportAndroidUserAgentStyleSheet, sizeof(WebCore::viewportAndroidUserAgentStyleSheet)));
+ OwnPtrWillBeRawPtr<WebCore::RuleSet> ruleSet = WebCore::RuleSet::create();
+ ruleSet->addRulesFromSheet(styleSheet.get(), WebCore::MediaQueryEvaluator("screen"));
+
+ Document* document = webViewHelper->webViewImpl()->page()->mainFrame()->document();
+ document->ensureStyleResolver().viewportStyleResolver()->collectViewportRules(ruleSet.get(), WebCore::ViewportStyleResolver::UserAgentOrigin);
+ document->ensureStyleResolver().viewportStyleResolver()->resolve();
+ }
+
static void configueCompositingWebView(WebSettings* settings)
{
settings->setForceCompositingMode(true);
@@ -882,6 +897,7 @@
FrameTestHelpers::WebViewHelper webViewHelper;
webViewHelper.initializeAndLoad(m_baseURL + "no_viewport_tag.html", true, 0, &client, enableViewportSettings);
+ applyViewportStyleOverride(&webViewHelper);
webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDPI(true);
webViewHelper.webView()->settings()->setUseWideViewport(true);
webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight));
@@ -1137,6 +1153,7 @@
FrameTestHelpers::WebViewHelper webViewHelper;
webViewHelper.initializeAndLoad(m_baseURL + "no_viewport_tag.html", true, 0, &client, enableViewportSettings);
+ applyViewportStyleOverride(&webViewHelper);
webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true);
webViewHelper.webView()->settings()->setUseWideViewport(true);
webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight));
@@ -1176,6 +1193,7 @@
FrameTestHelpers::WebViewHelper webViewHelper;
webViewHelper.initializeAndLoad(m_baseURL + "viewport-2x-initial-scale.html", true, 0, &client, enableViewportSettings);
+ applyViewportStyleOverride(&webViewHelper);
webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true);
webViewHelper.webView()->settings()->setUseWideViewport(true);
webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight));
@@ -1215,6 +1233,7 @@
FrameTestHelpers::WebViewHelper webViewHelper;
webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client, enableViewportSettings);
+ applyViewportStyleOverride(&webViewHelper);
webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true);
webViewHelper.webView()->settings()->setLoadWithOverviewMode(false);
webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageScaleFactor);
@@ -1298,6 +1317,7 @@
for (int quirkEnabled = 0; quirkEnabled <= 1; ++quirkEnabled) {
FrameTestHelpers::WebViewHelper webViewHelper;
webViewHelper.initializeAndLoad(m_baseURL + pages[i], true, 0, &client, enableViewportSettings);
+ applyViewportStyleOverride(&webViewHelper);
webViewHelper.webView()->settings()->setClobberUserAgentInitialScaleQuirk(quirkEnabled);
webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageScaleFactor);
webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight));
@@ -3048,7 +3068,7 @@
runPendingTasks();
// Load something into the subframe.
- WebFrame* subframe = frame->findChildByExpression(WebString::fromUTF8("/html/body/iframe"));
+ WebFrame* subframe = frame->firstChild();
ASSERT_TRUE(subframe);
subframe->loadHTMLString("sub<p>text", testURL);
runPendingTasks();
@@ -3538,7 +3558,7 @@
FrameTestHelpers::WebViewHelper webViewHelper;
initializeTextSelectionWebView(m_baseURL + "select_range_iframe.html", &webViewHelper);
frame = webViewHelper.webView()->mainFrame();
- WebFrame* subframe = frame->findChildByExpression(WebString::fromUTF8("/html/body/iframe"));
+ WebFrame* subframe = frame->firstChild();
EXPECT_EQ("Some test text for testing.", selectionAsString(subframe));
webViewHelper.webView()->selectionBounds(startWebRect, endWebRect);
subframe->executeCommand(WebString::fromUTF8("Unselect"));
@@ -5283,7 +5303,7 @@
EXPECT_EQ(1, client.callCount());
}
-TEST_F(WebFrameTest, sizeChangeRepaint)
+TEST_F(WebFrameTest, DISABLED_sizeChangeRepaint)
{
const char* kTests[] = {
"repaint/size-change-repaint1.html",
diff --git a/Source/web/tests/WebViewTest.cpp b/Source/web/tests/WebViewTest.cpp
index b4c496a..532df4e 100644
--- a/Source/web/tests/WebViewTest.cpp
+++ b/Source/web/tests/WebViewTest.cpp
@@ -1486,7 +1486,7 @@
CreateChildCounterFrameClient frameClient;
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("add_frame_in_unload.html"));
m_webViewHelper.initializeAndLoad(m_baseURL + "add_frame_in_unload.html", true, &frameClient);
- m_webViewHelper.webViewImpl()->dispatchUnloadEvent();
+ m_webViewHelper.webViewImpl()->mainFrame()->dispatchUnloadEvent();
EXPECT_EQ(0, frameClient.count());
m_webViewHelper.reset();
}
diff --git a/Source/web/tests/data/no_viewport_tag.html b/Source/web/tests/data/no_viewport_tag.html
index 897b8d8..fe1d2dc 100644
--- a/Source/web/tests/data/no_viewport_tag.html
+++ b/Source/web/tests/data/no_viewport_tag.html
@@ -1,12 +1,5 @@
<html>
<head>
- <style>
- /* Since tests are built with desktop viewport settings set the viewport
- to behave like Android */
- @viewport {
- min-width: 980px;
- }
- </style>
</head>
<body>
<p> Test </p>
diff --git a/Source/web/web.gypi b/Source/web/web.gypi
index 485e37d..7a20e90 100644
--- a/Source/web/web.gypi
+++ b/Source/web/web.gypi
@@ -271,19 +271,14 @@
'tests/DragImageTest.cpp',
'tests/FakeWebPlugin.cpp',
'tests/FakeWebPlugin.h',
- 'tests/FilterOperationsTest.cpp',
'tests/FrameLoaderClientImplTest.cpp',
'tests/FrameTestHelpers.cpp',
'tests/FrameTestHelpers.h',
- 'tests/GraphicsLayerTest.cpp',
- 'tests/ImageFilterBuilderTest.cpp',
- 'tests/ImageLayerChromiumTest.cpp',
'tests/KeyboardTest.cpp',
'tests/LinkHighlightTest.cpp',
'tests/ListenerLeakTest.cpp',
'tests/MemoryInfo.cpp',
'tests/MHTMLTest.cpp',
- 'tests/OpaqueRectTrackingContentLayerDelegateTest.cpp',
'tests/OpenTypeVerticalDataTest.cpp',
'tests/PageSerializerTest.cpp',
'tests/PaintAggregatorTest.cpp',
@@ -304,7 +299,6 @@
'tests/WebImageTest.cpp',
'tests/WebInputEventConversionTest.cpp',
'tests/WebInputEventFactoryTestMac.mm',
- 'tests/WEBPImageDecoderTest.cpp',
'tests/WebPageNewSerializerTest.cpp',
'tests/WebPageSerializerTest.cpp',
'tests/WebPluginContainerTest.cpp',
diff --git a/Source/web/win/WebFontRendering.cpp b/Source/web/win/WebFontRendering.cpp
index a171a41..6af08c6 100644
--- a/Source/web/win/WebFontRendering.cpp
+++ b/Source/web/win/WebFontRendering.cpp
@@ -16,6 +16,12 @@
}
// static
+void WebFontRendering::setDirectWriteFactory(IDWriteFactory* factory)
+{
+ WebCore::FontCache::setDirectWriteFactory(factory);
+}
+
+// static
void WebFontRendering::setUseSubpixelPositioning(bool useSubpixelPositioning)
{
WebCore::FontCache::setUseSubpixelPositioning(useSubpixelPositioning);