From 171a7426a95def81c4abf038730130f9e13c6788 Mon Sep 17 00:00:00 2001 From: Daz Jones Date: Wed, 29 Mar 2017 15:04:12 +0200 Subject: [PATCH] 2.1.0 --- NetFrontBrowserNX_OSSCopyright.txt | 2 +- WKC/WebCore/platform/graphics/WKC/FontWKC.cpp | 4 - .../graphics/WKC/MediaPlayerPrivateWKC.cpp | 5 +- .../platform/network/WKC/CertificateWKC.h | 3 +- .../platform/network/WKC/HTTPCacheWKC.cpp | 96 +++++++++++++++++-- .../platform/network/WKC/HTTPCacheWKC.h | 17 +++- .../network/WKC/ResourceHandleManagerWKC.cpp | 61 +++++++++++- .../network/WKC/ResourceHandleManagerWKC.h | 3 +- .../WKC/ResourceHandleManagerWKCSSL.cpp | 58 ++++++----- .../network/WKC/ResourceHandleManagerWKCSSL.h | 2 +- .../WKC/WebCoreSupport/ChromeClientWKC.cpp | 6 +- .../WebCoreSupport/FrameLoaderClientWKC.cpp | 10 ++ .../WKC/WebCoreSupport/FrameLoaderClientWKC.h | 3 +- WKC/WebKit/WKC/helpers/FrameLoaderClientIf.h | 12 ++- WKC/WebKit/WKC/helpers/WKCFocusController.h | 2 +- WKC/WebKit/WKC/helpers/WKCFrameSelection.h | 3 +- .../WKC/helpers/WKCHTMLFormControlElement.h | 3 +- WKC/WebKit/WKC/helpers/WKCResourceHandle.h | 3 +- .../helpers/privates/WKCFocusController.cpp | 11 ++- .../privates/WKCFocusControllerPrivate.h | 4 +- .../helpers/privates/WKCFrameSelection.cpp | 14 ++- .../privates/WKCFrameSelectionPrivate.h | 3 +- .../privates/WKCHTMLFormControlElement.cpp | 14 ++- .../WKCHTMLFormControlElementPrivate.h | 3 +- .../helpers/privates/WKCResourceHandle.cpp | 17 +++- .../privates/WKCResourceHandlePrivate.h | 3 +- WKC/WebKit/WKC/webkit/WKCVersion.h | 4 +- WKC/WebKit/WKC/webkit/WKCWebView.cpp | 74 +++++++++++--- WKC/WebKit/WKC/webkit/WKCWebView.h | 46 ++++++++- WKC/include/wkc/wkcmediapeer.h | 3 +- WKC/include/wkc/wkcpeer.h | 13 +++ webkit/JavaScriptCore/ChangeLog | 32 +++++++ .../heap/IncrementalSweeper.cpp | 13 ++- .../JavaScriptCore/heap/IncrementalSweeper.h | 3 + webkit/JavaScriptCore/runtime/ArgList.cpp | 44 +++++---- webkit/JavaScriptCore/runtime/ArgList.h | 8 +- .../runtime/BasicBlockLocation.h | 3 + .../runtime/ControlFlowProfiler.h | 3 + webkit/JavaScriptCore/runtime/SymbolTable.h | 15 ++- .../runtime/TypeLocationCache.h | 7 ++ webkit/JavaScriptCore/runtime/TypeProfiler.h | 3 + .../JavaScriptCore/runtime/TypeProfilerLog.h | 4 +- webkit/JavaScriptCore/runtime/Watchdog.cpp | 17 +++- webkit/WebCore/ChangeLog | 39 ++++++++ webkit/WebCore/css/StyleBuilderCustom.h | 8 +- webkit/WebCore/css/StyleSheetContents.cpp | 7 +- webkit/WebCore/dom/Node.cpp | 2 +- webkit/WebCore/html/HTMLMediaElement.cpp | 14 ++- webkit/WebCore/html/HTMLMediaElement.h | 1 + .../html/shadow/SliderThumbElement.cpp | 14 +++ .../WebCore/html/shadow/SliderThumbElement.h | 8 ++ webkit/WebCore/loader/DocumentLoader.cpp | 9 +- webkit/WebCore/page/FocusController.cpp | 76 ++++++++++----- webkit/WebCore/page/FocusController.h | 4 +- webkit/WebCore/page/SpatialNavigation.cpp | 10 +- webkit/WebCore/platform/ScrollView.cpp | 5 + .../WebCore/platform/graphics/FontCascade.cpp | 1 - .../WebCore/platform/graphics/MediaPlayer.cpp | 5 + .../WebCore/platform/graphics/MediaPlayer.h | 2 + .../platform/network/ResourceRequestBase.cpp | 3 +- webkit/WebCore/rendering/RenderBlock.cpp | 18 +++- webkit/WebCore/rendering/RenderBlockFlow.cpp | 11 +++ webkit/WebCore/rendering/RenderBox.cpp | 11 ++- webkit/WebCore/rendering/RenderInline.cpp | 18 +++- webkit/WebCore/rendering/RenderLayer.cpp | 8 ++ .../rendering/RenderLayerCompositor.cpp | 5 + .../rendering/RenderMultiColumnFlowThread.cpp | 26 ++++- webkit/WebCore/rendering/RenderObject.cpp | 12 ++- .../WebCore/rendering/RenderTextControl.cpp | 9 ++ webkit/WebCore/workers/WorkerThread.cpp | 13 ++- 70 files changed, 823 insertions(+), 170 deletions(-) diff --git a/NetFrontBrowserNX_OSSCopyright.txt b/NetFrontBrowserNX_OSSCopyright.txt index fd47c6416..dbc371dd8 100755 --- a/NetFrontBrowserNX_OSSCopyright.txt +++ b/NetFrontBrowserNX_OSSCopyright.txt @@ -1,3 +1,3 @@ OSS Copyright of NetFront Browser NX -Copyright (c) 2015-2016 ACCESS CO., LTD. All rights reserved. +Copyright (c) 2015-2017 ACCESS CO., LTD. All rights reserved. Some files in this package were modified by ACCESS CO., LTD. diff --git a/WKC/WebCore/platform/graphics/WKC/FontWKC.cpp b/WKC/WebCore/platform/graphics/WKC/FontWKC.cpp index a160c7df7..67b13e5ae 100755 --- a/WKC/WebCore/platform/graphics/WKC/FontWKC.cpp +++ b/WKC/WebCore/platform/graphics/WKC/FontWKC.cpp @@ -163,10 +163,6 @@ FontCascade::getTextWidth(const FontPlatformData& in_font, int in_flags, const u i++; continue; } - if (!(U16_IS_SURROGATE_LEAD(in_str[i]) && U16_IS_SURROGATE_TRAIL(in_str[i+1])) && in_str[i]!=0x0270A && in_str[i+1]!=0x20e3) { - i++; - continue; - } size_t emojilen = wkcDrawContextIsEmojiSequencePeer(&in_str[i], in_len-i); if (!emojilen) { diff --git a/WKC/WebCore/platform/graphics/WKC/MediaPlayerPrivateWKC.cpp b/WKC/WebCore/platform/graphics/WKC/MediaPlayerPrivateWKC.cpp index d1d57d343..6597aab19 100755 --- a/WKC/WebCore/platform/graphics/WKC/MediaPlayerPrivateWKC.cpp +++ b/WKC/WebCore/platform/graphics/WKC/MediaPlayerPrivateWKC.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2016 ACCESS CO., LTD. All rights reserved. + * Copyright (c) 2011-2017 ACCESS CO., LTD. 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 @@ -864,6 +864,9 @@ MediaPlayerPrivate::notifyPlayerState(int state) case WKC_MEDIA_PLAYERSTATE_RESETUSERGESTURERESTRICTION: m_player->resetUserGestureRestriction(); break; + case WKC_MEDIA_PLAYERSTATE_REMOVEUSERGESTURERESTRICTION: + m_player->removeUserGestureRestriction(); + break; default: break; } diff --git a/WKC/WebCore/platform/network/WKC/CertificateWKC.h b/WKC/WebCore/platform/network/WKC/CertificateWKC.h index 00541d7e8..0e79f7d44 100755 --- a/WKC/WebCore/platform/network/WKC/CertificateWKC.h +++ b/WKC/WebCore/platform/network/WKC/CertificateWKC.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010,2011 ACCESS CO., LTD. All rights reserved. + * Copyright (c) 2010-2016 ACCESS CO., LTD. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,6 +34,7 @@ namespace WebCore { class ClientCertificate { + WTF_MAKE_FAST_ALLOCATED; public: ClientCertificate(); ~ClientCertificate(); diff --git a/WKC/WebCore/platform/network/WKC/HTTPCacheWKC.cpp b/WKC/WebCore/platform/network/WKC/HTTPCacheWKC.cpp index 6b3d62b29..fee09d8c4 100755 --- a/WKC/WebCore/platform/network/WKC/HTTPCacheWKC.cpp +++ b/WKC/WebCore/platform/network/WKC/HTTPCacheWKC.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2016 ACCESS CO., LTD. All rights reserved. + * Copyright (c) 2011-2017 ACCESS CO., LTD. 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 @@ -28,6 +28,7 @@ #include "FileSystem.h" #include "ResourceResponse.h" #include "ResourceHandleClient.h" +#include "ResourceHandleInternalWKC.h" #include #include #include @@ -35,6 +36,8 @@ #include #include +#include "WKCEnums.h" + #ifdef __WKC_IMPLICIT_INCLUDE_SYSSTAT #include #endif @@ -65,6 +68,9 @@ HTTPCachedResource::HTTPCachedResource(const String& filename) m_lastModified = 0; m_responseTime = 0; m_age = 0; + m_isSSL = false; + m_secureState = WKC::ESecureStateWhite; /* non-ssl */ + m_secureLevel = WKC::ESecureLevelNonSSL; /* non-ssl */ m_contentLength = 0; m_resourceSize = 0; @@ -193,6 +199,14 @@ bool HTTPCachedResource::setResourceResponse(const ResourceResponse &response, b m_lastModifiedHeader = response.httpHeaderField(String("Last-Modified")); m_eTagHeader = response.httpHeaderField(String("ETag")); m_age = response.age() ? (double)response.age().value().count() / 1000 / 1000 : numeric_limits::quiet_NaN(); + m_accessControlAllowOriginHeader = response.httpHeaderField(String("Access-Control-Allow-Origin")); + + ResourceHandle* job = response.resourceHandle(); + ResourceHandleInternal* d = job->getInternal(); + m_isSSL = d->m_isSSL; + m_isEVSSL = d->m_isEVSSL; + m_secureState = d->m_secureState; + m_secureLevel = d->m_secureLevel; if (!(m_httpequivflags&EHTTPEquivNoCache)) m_noCache = response.cacheControlContainsNoCache(); @@ -219,18 +233,16 @@ bool HTTPCachedResource::writeFile(const String& filepath) return result; const char *buf = 0; - int len, length, written = 0, position = 0; + wkc_uint64 len = 0, length = 0, written = 0, position = 0; for (len = m_resourceData->size(); len > 0; len -= length) { length = m_resourceData->getSomeData(buf, position); if (!length) goto error_end; - for (int writelength = length; writelength > 0; writelength -= written) { - written = wkcFileFWritePeer(buf, sizeof(char), writelength, fd); - if (written < 0) - goto error_end; - } + written = wkcFileFWritePeer(buf, sizeof(char), length, fd); + if (written < length) + goto error_end; position += length; } nxLog_i("cache write %s", m_url.utf8().data()); @@ -283,7 +295,7 @@ bool HTTPCachedResource::readFile(char *out_buf, const String& filepath) void HTTPCachedResource::calcResourceSize() { size_t size = sizeof(long long) * 2 - + sizeof(int) * 3 + + sizeof(int) * 7 + sizeof(double) * 6 + sizeof(int) + ROUNDUP(m_url.utf8().length(), ROUNDUP_UNIT) + sizeof(int) + ROUNDUP(m_mimeType.utf8().length(), ROUNDUP_UNIT) @@ -291,7 +303,8 @@ void HTTPCachedResource::calcResourceSize() + sizeof(int) + ROUNDUP(m_suggestedFilename.utf8().length(), ROUNDUP_UNIT) + sizeof(int) + ROUNDUP(m_fileName.utf8().length(), ROUNDUP_UNIT) + sizeof(int) + ROUNDUP(m_lastModifiedHeader.utf8().length(), ROUNDUP_UNIT) - + sizeof(int) + ROUNDUP(m_eTagHeader.utf8().length(), ROUNDUP_UNIT); + + sizeof(int) + ROUNDUP(m_eTagHeader.utf8().length(), ROUNDUP_UNIT) + + sizeof(int) + ROUNDUP(m_accessControlAllowOriginHeader.utf8().length(), ROUNDUP_UNIT); m_resourceSize = ROUNDUP(size, ROUNDUP_UNIT); } @@ -318,6 +331,10 @@ int HTTPCachedResource::serialize(char *buffer) (*(int*)buffer) = m_httpStatusCode; buffer += sizeof(int); (*(int*)buffer) = m_noCache ? 1 : 0; buffer += sizeof(int); (*(int*)buffer) = m_mustRevalidate ? 1 : 0; buffer += sizeof(int); + (*(int*)buffer) = m_isSSL ? 1 : 0; buffer += sizeof(int); + (*(int*)buffer) = m_isEVSSL ? 1 : 0; buffer += sizeof(int); + (*(int*)buffer) = m_secureState; buffer += sizeof(int); + (*(int*)buffer) = m_secureLevel; buffer += sizeof(int); (*(double*)buffer) = m_expires; buffer += sizeof(double); (*(double*)buffer) = m_maxAge; buffer += sizeof(double); (*(double*)buffer) = m_date; buffer += sizeof(double); @@ -332,6 +349,7 @@ int HTTPCachedResource::serialize(char *buffer) buffer += writeString(buffer, m_fileName); buffer += writeString(buffer, m_lastModifiedHeader); buffer += writeString(buffer, m_eTagHeader); + buffer += writeString(buffer, m_accessControlAllowOriginHeader); return ROUNDUP(buffer - buf, ROUNDUP_UNIT); } @@ -356,6 +374,10 @@ int HTTPCachedResource::deserialize(char *buffer) m_httpStatusCode = (*(int*)buffer); buffer += sizeof(int); m_noCache = (*(int*)buffer); buffer += sizeof(int); m_mustRevalidate = (*(int*)buffer); buffer += sizeof(int); + m_isSSL = (*(int*)buffer); buffer += sizeof(int); + m_isEVSSL = (*(int*)buffer); buffer += sizeof(int); + m_secureState = (*(int*)buffer); buffer += sizeof(int); + m_secureLevel = (*(int*)buffer); buffer += sizeof(int); m_expires = (*(double*)buffer); buffer += sizeof(double); m_maxAge = (*(double*)buffer); buffer += sizeof(double); m_date = (*(double*)buffer); buffer += sizeof(double); @@ -370,6 +392,7 @@ int HTTPCachedResource::deserialize(char *buffer) buffer += readString(buffer, m_fileName); buffer += readString(buffer, m_lastModifiedHeader); buffer += readString(buffer, m_eTagHeader); + buffer += readString(buffer, m_accessControlAllowOriginHeader); calcResourceSize(); @@ -813,7 +836,7 @@ bool HTTPCache::deserializeFATData(char *buffer, int length) } #define DEFAULT_CACHEFAT_FILENAME "cache.fat" -#define CACHEFAT_FORMAT_VERSION 4 // Number of int. Increment this if you changed the content format in the fat file. +#define CACHEFAT_FORMAT_VERSION 6 // Number of int. Increment this if you changed the content format in the fat file. #define MD5_DIGESTSIZE 16 @@ -979,6 +1002,59 @@ bool HTTPCache::readFATFile() return result; } +void +HTTPCache::dumpResourceList() +{ + int num = m_resourceList.size(); + + nxLog_e("HTTP Cache info"); + for (int i = 0; i < num; i++){ + HTTPCachedResource *resource = m_resourceList[i]; + nxLog_e("----------"); + nxLog_e("Cache %d: %s", i, resource->fileName().utf8().data()); + nxLog_e(" URL: %s", resource->url().utf8().data()); + nxLog_e(" mime type: %s content length: %ld HTTP Status code: %d", resource->mimeType().utf8().data(), resource->contentLength(), resource->httpStatusCode()); + nxLog_e(" expires: %lf max-age: %lf", resource->expires(), resource->maxAge()); + nxLog_e(" Last-Modified: %s", resource->lastModifiedHeader().utf8().data()); + nxLog_e(" eTag: %s", resource->eTagHeader().utf8().data()); + nxLog_e(" isSSL: %s", resource->isSSL() ? "true" : "false"); + switch (resource->secureState()){ + case WKC::SSLSecureState::ESecureStateRed: + nxLog_e(" SSL Secure state: Red (Danger)"); + break; + case WKC::SSLSecureState::ESecureStateWhite: + nxLog_e(" SSL Secure state: White (non-ssl)"); + break; + case WKC::SSLSecureState::ESecureStateBlue: + nxLog_e(" SSL Secure state: Blue (Normal SSL)"); + break; + case WKC::SSLSecureState::ESecureStateGreen: + nxLog_e(" SSL Secure state: Green (EV SSL)"); + break; + default: + break; + } + switch (resource->secureLevel()) { + case WKC::SSLSecureLevel::ESecureLevelUnahthorized: + nxLog_e(" SSL Secure level: Unauthorized"); + break; + case WKC::SSLSecureLevel::ESecureLevelNonSSL: + nxLog_e(" SSL Secure level: non-ssl"); + break; + case WKC::SSLSecureLevel::ESecureLevelInsecure: + nxLog_e(" SSL Secure level: Insecure"); + break; + case WKC::SSLSecureLevel::ESecureLevelSecure: + nxLog_e(" SSL Secure level: Secure"); + break; + default: + break; + } + nxLog_e("----------"); + } + nxLog_e("HTTP Cache info end."); +} + } // namespace #endif // ENABLE(WKC_HTTPCACHE) diff --git a/WKC/WebCore/platform/network/WKC/HTTPCacheWKC.h b/WKC/WebCore/platform/network/WKC/HTTPCacheWKC.h index 86d870694..90f2e2f47 100755 --- a/WKC/WebCore/platform/network/WKC/HTTPCacheWKC.h +++ b/WKC/WebCore/platform/network/WKC/HTTPCacheWKC.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2016 ACCESS CO., LTD. All rights reserved. + * Copyright (c) 2011-2017 ACCESS CO., LTD. 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 @@ -68,6 +68,12 @@ WTF_MAKE_FAST_ALLOCATED; inline double maxAge() const { return m_maxAge; } inline const String& lastModifiedHeader() const { return m_lastModifiedHeader; } inline const String& eTagHeader() const { return m_eTagHeader; } + inline const String& accessControlAllowOriginHeader() const { return m_accessControlAllowOriginHeader; } + + inline bool isSSL() const { return m_isSSL; } + inline bool isEVSSL() const { return m_isEVSSL; } + inline int secureState() const { return m_secureState; } + inline int secureLevel() const { return m_secureLevel; } inline bool serverPushed() const { return m_serverpushed; } @@ -105,6 +111,12 @@ WTF_MAKE_FAST_ALLOCATED; String m_lastModifiedHeader; String m_eTagHeader; String m_fileName; + String m_accessControlAllowOriginHeader; + + bool m_isSSL; + bool m_isEVSSL; + int m_secureState; + int m_secureLevel; SharedBuffer* m_resourceData; long long m_contentLength; @@ -163,6 +175,9 @@ class HTTPCache { void writeDigest(unsigned char *data, int length); bool verifyDigest(unsigned char *data, int length); + // for debug + void dumpResourceList(); + private: bool m_disabled; HTTPCachedResourceMap m_resources; diff --git a/WKC/WebCore/platform/network/WKC/ResourceHandleManagerWKC.cpp b/WKC/WebCore/platform/network/WKC/ResourceHandleManagerWKC.cpp index d61499264..1280dc95d 100755 --- a/WKC/WebCore/platform/network/WKC/ResourceHandleManagerWKC.cpp +++ b/WKC/WebCore/platform/network/WKC/ResourceHandleManagerWKC.cpp @@ -8,7 +8,7 @@ * Copyright (C) 2009 Appcelerator Inc. * Copyright (C) 2009 Brent Fulgham * All rights reserved. - * Copyright (c) 2010-2016 ACCESS CO., LTD. All rights reserved. + * Copyright (c) 2010-2017 ACCESS CO., LTD. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -93,6 +93,9 @@ #define NO_NXLOG #include "utils/nxDebugPrint.h" +// customize difinition +#define ENABLE_WKC_HTTPCACHE_EXCLUDE_ROOT_CONTENT 1 // exclude https root content from HTTP cache. + using namespace std; namespace WebCore { @@ -1223,6 +1226,11 @@ size_t ResourceHandleManager::downloadTimerHeaderCallback(ResourceHandle* job, R authJar()->setWebUserPassword(d->m_webAuthURL, ProtectionSpaceServerHTTP, d->m_webAuthScheme, d->m_webAuthRealm, d->m_webAuthUser, d->m_webAuthPass, location, true); } + // delete previous Authorization data. + cancelAuthChallenge(job, d->m_currentWebChallenge.protectionSpace().isProxy()); + curl_easy_setopt(d->m_handle, CURLOPT_USERNAME, NULL); + curl_easy_setopt(d->m_handle, CURLOPT_PASSWORD, NULL); + if (WKC::EInclusionContentComposition < d->m_composition) { d->m_firstRequest.setFirstPartyForCookies(newURL); } @@ -1277,6 +1285,13 @@ size_t ResourceHandleManager::downloadTimerHeaderCallback(ResourceHandle* job, R } } +#if ENABLE(WKC_HTTPCACHE) + if (httpCode == 304) { + // We must not call didReceiveResponse() when cache is alive, it must be called cache loading. + return totalSize; + } +#endif + if (!d->m_response.mimeType().isEmpty()) { if (d->client()) d->client()->didReceiveResponse(job, d->m_response); @@ -1707,7 +1722,11 @@ bool ResourceHandleManager::finalizingResourceHandle(ResourceHandle* job, Resour data will be shown to the user. */ /* fall through */ case CURLE_PARTIAL_FILE: +#if ENABLE(WKC_HTTPCACHE) + if (!(httpCode == 304 && d->m_utilizedHTTPCache) && !d->m_response.responseFired()) { +#else if (!d->m_response.responseFired()) { +#endif handleLocalReceiveResponse(d->m_handle, job, d); if (d->m_cancelled || d->m_didAuthChallenge || d->m_doRedirectChallenge) { finishLoadingResourceHandle(job, d); @@ -1730,7 +1749,11 @@ bool ResourceHandleManager::finalizingResourceHandle(ResourceHandle* job, Resour case 300: case 301: case 410: +#if ENABLE(WKC_HTTPCACHE_EXCLUDE_ROOT_CONTENT) + if (((!job->frame() || !job->frame()->loader().isHostedByObjectElement())) && !(d->m_isSSL && contentComposition(job) == WKC::ERootFrameRootContentComposition)) { +#else if (!job->frame() || !job->frame()->loader().isHostedByObjectElement()) { +#endif addHTTPCache(job, url, d->client()->resourceData(), d->m_response); } break; @@ -1774,10 +1797,14 @@ bool ResourceHandleManager::finalizingResourceHandle(ResourceHandle* job, Resour WKC::FrameLoaderClientWKC* fl = frameloaderclientwkc(job); if (d->m_isSSL && !d->m_SSLHandshaked && fl) { m_rhmssl->SSLHandshakeInfo(job); - if (fl->notifySSLHandshakeStatus(job, WKC::EHandshakeFail)) { - // true means try to re-connect even though current SSL is failed - d->m_sslReconnect = true; - break; + bool isHandshakeError = (d->m_msgDataResult == CURLE_SSL_CACERT) || + (d->m_msgDataResult == CURLE_PEER_FAILED_VERIFICATION); + if (isHandshakeError) { + if (fl->notifySSLHandshakeStatus(job, WKC::EHandshakeFail)) { + // true means try to re-connect even though current SSL is failed + d->m_sslReconnect = true; + break; + } } d->m_SSLHandshaked = true; } @@ -2305,7 +2332,11 @@ void ResourceHandleManager::add(ResourceHandle* job) nxLog_i("Async load add [%p] %s", job, kurl.string().latin1().data()); #if ENABLE(WKC_HTTPCACHE) +#if ENABLE(WKC_HTTPCACHE_EXCLUDE_ROOT_CONTENT) + if (!m_httpCache.disabled() && job->firstRequest().cachePolicy() != ReloadIgnoringCacheData && !( kurl.protocolIs("https") && contentComposition(job) == WKC::ERootFrameRootContentComposition) ) { +#else if (!m_httpCache.disabled() && job->firstRequest().cachePolicy() != ReloadIgnoringCacheData) { +#endif HTTPCachedResource *resource = m_httpCache.resourceForURL(kurl); if (resource) { // this resource has been used @@ -2787,6 +2818,10 @@ void ResourceHandleManager::dispatchSynchronousJob(ResourceHandle* rjob) failed = true; break; } + } else { + kurl = job->firstRequest().url(); + d->m_url = fastStrdup(kurl.string().latin1().data()); + initializeHandle(job); } curl_multi_add_handle(m_curlMultiSyncHandle, d->m_handle); @@ -4555,6 +4590,8 @@ bool ResourceHandleManager::addHTTPCache(ResourceHandle *handle, URL &url, Share void ResourceHandleManager::scheduleLoadResourceFromHTTPCache(ResourceHandle *job) { job->ref(); + ResourceHandleInternal* d = job->getInternal(); + d->m_composition = contentComposition(job); m_readCacheJobList.append(job); if (!m_readCacheTimer.isActive()) { m_readCacheTimer.startOneShot(pollTimeSeconds); @@ -4592,6 +4629,9 @@ void ResourceHandleManager::readCacheTimerCallback() d->m_response.setHTTPStatusCode(resource->httpStatusCode()); d->m_response.setHTTPHeaderField(String("Last-Modified"), resource->lastModifiedHeader()); d->m_response.setSource(ResourceResponse::Source::DiskCache); + if (!resource->accessControlAllowOriginHeader().isEmpty()) { + d->m_response.setHTTPHeaderField(String("Access-Control-Allow-Origin"), resource->accessControlAllowOriginHeader()); + } if (!d->client()) goto cancel; d->client()->didReceiveResponse(job, d->m_response); @@ -4601,6 +4641,10 @@ void ResourceHandleManager::readCacheTimerCallback() if (frame!=job->frame()) { goto cancel; } + d->m_isSSL = resource->isSSL(); + d->m_isEVSSL = resource->isEVSSL(); + d->m_secureState = resource->secureState(); + d->m_secureLevel = resource->secureLevel(); WKC::FrameLoaderClientWKC* fl = frameloaderclientwkc(job); if (!fl || !fl->dispatchWillReceiveData(job, resource->contentLength())) goto cancel; @@ -4614,6 +4658,7 @@ void ResourceHandleManager::readCacheTimerCallback() if (m_httpCache.read(resource, buf)) { d->client()->didReceiveData(job, buf, resource->contentLength(), 0); d->client()->didFinishLoading(job, monotonicallyIncreasingTime()); + fl->didRestoreFromHTTPCache(job, kurl); } else { d->client()->didFail(job, ResourceError(String(), CURLE_READ_ERROR, String(d->m_url), String("cache read error"), 0)); m_httpCache.removeAll(); @@ -4784,6 +4829,12 @@ void ResourceHandleManager::processHttpEquiv(const String& content, const URL& u rsp->update(nocache, mustrevalidate, expires, maxage, flags); } +void +ResourceHandleManager::dumpHTTPCacheResourceList() +{ + httpCache()->dumpResourceList(); +} + #endif // ENABLE(WKC_HTTPCACHE) // diff --git a/WKC/WebCore/platform/network/WKC/ResourceHandleManagerWKC.h b/WKC/WebCore/platform/network/WKC/ResourceHandleManagerWKC.h index 6cd6a3b50..8db8b9186 100755 --- a/WKC/WebCore/platform/network/WKC/ResourceHandleManagerWKC.h +++ b/WKC/WebCore/platform/network/WKC/ResourceHandleManagerWKC.h @@ -2,7 +2,7 @@ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com * All rights reserved. - * Copyright (c) 2010-2016 ACCESS CO., LTD. All rights reserved. + * Copyright (c) 2010-2017 ACCESS CO., LTD. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -183,6 +183,7 @@ WTF_MAKE_FAST_ALLOCATED; void clearHTTPCache(); void resetHTTPCache(); void processHttpEquiv(const String& content, const URL& url, bool cachecontrol); + void dumpHTTPCacheResourceList(); #endif bool isMatchProxyFilter(const String& host); diff --git a/WKC/WebCore/platform/network/WKC/ResourceHandleManagerWKCSSL.cpp b/WKC/WebCore/platform/network/WKC/ResourceHandleManagerWKCSSL.cpp index f7339de92..16661665d 100755 --- a/WKC/WebCore/platform/network/WKC/ResourceHandleManagerWKCSSL.cpp +++ b/WKC/WebCore/platform/network/WKC/ResourceHandleManagerWKCSSL.cpp @@ -525,15 +525,17 @@ ssl_app_verify_callback(X509_STORE_CTX *ctx, void *data) } #endif -static void -ssl_cert_request_callback(const SSL *ssl, int type, int val) +static int +ssl_cert_request_callback(SSL *ssl, X509 **x509, EVP_PKEY **pkey) { - if (type != SSL_CB_CONNECT_LOOP || val != 1) - return; - - nxLog_in("ssl:%p type:%d val:%d", ssl, type, val); - ResourceHandleManager::sharedInstance()->rhmssl()->ClientCertSelectCallback((void*)ssl); + nxLog_in("ssl:%p ", ssl); + ResourceHandleManager::sharedInstance()->rhmssl()->ClientCertSelectCallback((void*)ssl, x509, pkey); + if (x509 && pkey) { + nxLog_out("ssl:%p x509:%p pkey:%p", ssl, x509, pkey); + return 1; + } nxLog_out(""); + return 0; } static int @@ -568,7 +570,8 @@ sslctx_callback(CURL* handle, void* sslctx, void* data) } URL kurl = job->firstRequest().url(); - SSL_CTX_set_info_callback(sslCtx, ssl_cert_request_callback); + SSL_CTX_set_client_cert_cb(sslCtx, ssl_cert_request_callback); + SSL_CTX_set_app_data(sslCtx, job); SSL_CTX_set_verify(sslCtx, SSL_CTX_get_verify_mode(sslCtx), ssl_verify_callback); //SSL_CTX_set_cert_verify_callback(sslCtx, ssl_app_verify_callback, data); @@ -625,7 +628,7 @@ void ResourceHandleManagerSSL::initializeHandleSSL(ResourceHandle* job) curl_easy_setopt(d->m_handle, CURLOPT_SSL_VERIFYPEER, 1); } - curl_easy_setopt(d->m_handle, CURLOPT_SSL_CIPHER_LIST, "ALL:!aNULL:!eNULL:!SSLv2:!RC2:!RC4:!DES:!EXPORT56:!ADH:+HIGH:+MEDIUM:!LOW"); + curl_easy_setopt(d->m_handle, CURLOPT_SSL_CIPHER_LIST, "ALL:!aNULL:!eNULL:!SSLv2:!RC2:!RC4:!DES:!EXPORT56:!ADH:!DH:!kECDH:+kECDHe:+HIGH:+MEDIUM:!LOW"); // curl_easy_setopt(d->m_handle, CURLOPT_SSL_VERIFYSTATUS, (long)1); d->m_SSLVerifyPeerResult = 0; @@ -790,8 +793,9 @@ void ResourceHandleManagerSSL::SSLHandshakeInfo(ResourceHandle* job) // callback functions // -static void setClientCertAndKey(SSL* ssl, ClientCertificate* cert) +static void setClientCertAndKey(SSL* ssl, ClientCertificate* cert, X509 **x509, EVP_PKEY **pkey) { + X509* cert_dup = NULL; EVP_PKEY* pri = NULL; int orgkey_len; @@ -805,8 +809,12 @@ static void setClientCertAndKey(SSL* ssl, ClientCertificate* cert) goto exit_func; } + cert_dup = X509_dup(cert->cert()); + if (!cert_dup) + goto exit_func; + SSL_set_mode(ssl, SSL_MODE_NO_AUTO_CHAIN); - if (SSL_use_certificate(ssl, cert->cert()) != 1) { + if (SSL_use_certificate(ssl, cert_dup) != 1) { goto exit_func; } if (SSL_use_PrivateKey(ssl, pri) != 1) { @@ -814,15 +822,22 @@ static void setClientCertAndKey(SSL* ssl, ClientCertificate* cert) } SSL_check_private_key(ssl); + *x509 = cert_dup; + *pkey = pri; + + return; + exit_func: if (orgkey) { memset(orgkey, 0, orgkey_len); // delete private key completely fastFree(orgkey); } + if (cert_dup) + X509_free(cert_dup); if (pri) EVP_PKEY_free(pri); } -void ResourceHandleManagerSSL::ClientCertSelectCallback(void *data) +void ResourceHandleManagerSSL::ClientCertSelectCallback(void *data, X509 **x509, EVP_PKEY **pkey) { SSL* ssl = (SSL*)data; if (!ssl) return; @@ -841,14 +856,15 @@ void ResourceHandleManagerSSL::ClientCertSelectCallback(void *data) ClientCertificate** certInfo = NULL; int certInfoIdx = -1; int certInfoNum = 0; - EVP_PKEY *pri = NULL; STACK_OF(X509) *ca = NULL; - X509 *x509 = NULL; unsigned char* orgpass = NULL; int orgpass_len = 0; X509 *server = NULL; char* requester = NULL; + *x509 = NULL; + *pkey = NULL; + // should verify success! if (ssl->verify_mode != SSL_VERIFY_NONE && 0 != SSL_get_verify_result(ssl)) return; @@ -870,7 +886,6 @@ void ResourceHandleManagerSSL::ClientCertSelectCallback(void *data) case SSL3_VERSION: #endif if (!ssl->s3) return; - if (ssl->s3->tmp.message_type != SSL3_MT_CERTIFICATE_REQUEST) return; break; case DTLS1_VERSION: if (!ssl->d1) return; @@ -912,7 +927,6 @@ void ResourceHandleManagerSSL::ClientCertSelectCallback(void *data) case SSL3_VERSION: #endif if (!ssl->s3) return; - if (ssl->s3->tmp.message_type != SSL3_MT_CERTIFICATE_REQUEST) return; nxLog_i("SSLv3/TLS"); @@ -963,7 +977,7 @@ void ResourceHandleManagerSSL::ClientCertSelectCallback(void *data) if (!cert) return; if (cert->cert() && cert->privateKey()) { - setClientCertAndKey(ssl, cert); + setClientCertAndKey(ssl, cert, x509, pkey); return; } @@ -972,12 +986,12 @@ void ResourceHandleManagerSSL::ClientCertSelectCallback(void *data) if (!orgpass) break; - if (!parse_pkcs12((const unsigned char *)cert->pkcs12(), cert->pkcs12len(), (const char *)orgpass, &pri, &x509, &ca)) + if (!parse_pkcs12((const unsigned char *)cert->pkcs12(), cert->pkcs12len(), (const char *)orgpass, pkey, x509, &ca)) break; - if (SSL_use_certificate(ssl, x509) != 1) + if (SSL_use_certificate(ssl, *x509) != 1) break; - if (SSL_use_PrivateKey(ssl, pri) != 1) + if (SSL_use_PrivateKey(ssl, *pkey) != 1) break; if (!SSL_check_private_key(ssl)) break; @@ -991,9 +1005,7 @@ void ResourceHandleManagerSSL::ClientCertSelectCallback(void *data) } break; } - if (orgpass) delete [] orgpass; - if (pri) EVP_PKEY_free(pri); - if (x509) X509_free(x509); + if (orgpass) fastFree(orgpass); return; } diff --git a/WKC/WebCore/platform/network/WKC/ResourceHandleManagerWKCSSL.h b/WKC/WebCore/platform/network/WKC/ResourceHandleManagerWKCSSL.h index bdff795ae..1d7e264dc 100755 --- a/WKC/WebCore/platform/network/WKC/ResourceHandleManagerWKCSSL.h +++ b/WKC/WebCore/platform/network/WKC/ResourceHandleManagerWKCSSL.h @@ -120,7 +120,7 @@ WTF_MAKE_FAST_ALLOCATED; void SSLHandshakeInfo(ResourceHandle* job); - void ClientCertSelectCallback(void* ssl); + void ClientCertSelectCallback(void* ssl, X509 **x509, EVP_PKEY **pkey); CURLSH* getCurlShareHandle(void) { return m_curlShareHandle; } diff --git a/WKC/WebKit/WKC/WebCoreSupport/ChromeClientWKC.cpp b/WKC/WebKit/WKC/WebCoreSupport/ChromeClientWKC.cpp index 853cc3b2a..19ebff5b3 100755 --- a/WKC/WebKit/WKC/WebCoreSupport/ChromeClientWKC.cpp +++ b/WKC/WebKit/WKC/WebCoreSupport/ChromeClientWKC.cpp @@ -4,7 +4,7 @@ * Copyright (C) 2008 Nuanti Ltd. * Copyright (C) 2008 Alp Toker * Copyright (C) 2008 Gustavo Noronha Silva - * Copyright (c) 2010-2016 ACCESS CO., LTD. All rights reserved. + * Copyright (c) 2010-2017 ACCESS CO., LTD. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -484,6 +484,10 @@ ChromeClientWKC::scrollRectIntoView(const WebCore::IntRect& rect) const void ChromeClientWKC::focusedFrameChanged(WebCore::Frame* frame) { + if (!frame) { + m_appClient->focusedFrameChanged(nullptr); + return; + } FramePrivate fp(frame); m_appClient->focusedFrameChanged(&fp.wkc()); } diff --git a/WKC/WebKit/WKC/WebCoreSupport/FrameLoaderClientWKC.cpp b/WKC/WebKit/WKC/WebCoreSupport/FrameLoaderClientWKC.cpp index 35f0ab841..92fa5928a 100755 --- a/WKC/WebKit/WKC/WebCoreSupport/FrameLoaderClientWKC.cpp +++ b/WKC/WebKit/WKC/WebCoreSupport/FrameLoaderClientWKC.cpp @@ -579,6 +579,13 @@ FrameLoaderClientWKC::dispatchWillPermitSendRequest(WebCore::ResourceHandle* han return m_appClient->dispatchWillPermitSendRequest((void*)handle, url, (WKC::ContentComposition)composition, isSync, res.wkc()); } +void +FrameLoaderClientWKC::didRestoreFromHTTPCache(WebCore::ResourceHandle* handle, const WebCore::URL& url) +{ + ResourceHandlePrivate hdl(handle); + m_appClient->didRestoreFromHTTPCache(&hdl.wkc(), url); +} + #ifdef WKC_ENABLE_CUSTOMJS bool FrameLoaderClientWKC::dispatchWillCallCustomJS(WKCCustomJSAPIList* api, void** context) @@ -709,6 +716,9 @@ FrameLoaderClientWKC::createFrame(const WebCore::URL& url, const WTF::String& na frame->tree().appendChild(childframe); childframe->init(); + if (!frame->loader().activeDocumentLoader()) { + return 0; + } frame->loader().loadURLIntoChildFrame(url, referrer, childframe.get()); if (!childframe->tree().parent()) { return 0; diff --git a/WKC/WebKit/WKC/WebCoreSupport/FrameLoaderClientWKC.h b/WKC/WebKit/WKC/WebCoreSupport/FrameLoaderClientWKC.h index eabbc571d..dc90f36be 100755 --- a/WKC/WebKit/WKC/WebCoreSupport/FrameLoaderClientWKC.h +++ b/WKC/WebKit/WKC/WebCoreSupport/FrameLoaderClientWKC.h @@ -3,7 +3,7 @@ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. * Copyright (C) 2008 Collabora Ltd. All rights reserved. * All rights reserved. - * Copyright (c) 2010-2015 ACCESS CO., LTD. All rights reserved. + * Copyright (c) 2010-2016 ACCESS CO., LTD. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -237,6 +237,7 @@ class FrameLoaderClientWKC : public WebCore::FrameLoaderClient { bool dispatchWillReceiveData(WebCore::ResourceHandle*, int length); int requestSSLClientCertSelect(WebCore::ResourceHandle* handle, const char* requester, void* certs, int num); int dispatchWillPermitSendRequest(WebCore::ResourceHandle* handle, const char* url, int composition, bool isSync, const WebCore::ResourceResponse& redirectResponse); + void didRestoreFromHTTPCache(WebCore::ResourceHandle* handle, const WebCore::URL& url); #ifdef WKC_ENABLE_CUSTOMJS virtual bool dispatchWillCallCustomJS(WKCCustomJSAPIList* api, void** context); //override; diff --git a/WKC/WebKit/WKC/helpers/FrameLoaderClientIf.h b/WKC/WebKit/WKC/helpers/FrameLoaderClientIf.h index 2b1be6ac8..3a12ef107 100755 --- a/WKC/WebKit/WKC/helpers/FrameLoaderClientIf.h +++ b/WKC/WebKit/WKC/helpers/FrameLoaderClientIf.h @@ -3,7 +3,7 @@ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. * Copyright (C) 2008 Collabora Ltd. All rights reserved. * All rights reserved. - * Copyright (c) 2010-2015 ACCESS CO., LTD. All rights reserved. + * Copyright (c) 2010-2016 ACCESS CO., LTD. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -1088,6 +1088,16 @@ class WKC_API FrameLoaderClientIf { Extension of NetFront Browser NX by ACCESS CO., LTD. */ virtual int dispatchWillPermitSendRequest(void* handle, const char* url, WKC::ContentComposition composition, bool isSync, const WKC::ResourceResponse& redirectResponse) = 0; + /** + @brief notify loading from HTTP cache. + @param handle pointer to WKC::ResourceHandle. + @param url content URL when request from network. + @details + this function is called when finished loading from HTTP cache. + @attention + Extension of NetFront Browser NX by ACCESS CO., LTD. + */ + virtual void didRestoreFromHTTPCache(WKC::ResourceHandle* handle, const WKC::KURL& url) = 0; #ifdef WKC_ENABLE_CUSTOMJS virtual bool dispatchWillCallCustomJS(WKCCustomJSAPIList* api, void** context) = 0; #endif // WKC_ENABLE_CUSTOMJS diff --git a/WKC/WebKit/WKC/helpers/WKCFocusController.h b/WKC/WebKit/WKC/helpers/WKCFocusController.h index e361660bb..380a19324 100755 --- a/WKC/WebKit/WKC/helpers/WKCFocusController.h +++ b/WKC/WebKit/WKC/helpers/WKCFocusController.h @@ -35,7 +35,7 @@ class WKC_API FocusController { Frame* focusedOrMainFrame(); FocusControllerPrivate& priv() const { return m_private; } - Element* findNextFocusableElement(const FocusDirection& direction, const WKCRect* scope = 0); + Element* findNextFocusableElement(const FocusDirection& direction, const WKCRect* scope = 0, Element* base = 0); Element* findNearestFocusableElementFromPoint(const WKCPoint& point, const WKCRect* scope = 0); protected: diff --git a/WKC/WebKit/WKC/helpers/WKCFrameSelection.h b/WKC/WebKit/WKC/helpers/WKCFrameSelection.h index e649a4377..50a72bca8 100755 --- a/WKC/WebKit/WKC/helpers/WKCFrameSelection.h +++ b/WKC/WebKit/WKC/helpers/WKCFrameSelection.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2015 ACCESS CO., LTD. All rights reserved. + * Copyright (c) 2011-2017 ACCESS CO., LTD. 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 @@ -32,6 +32,7 @@ class WKC_API FrameSelection { bool isCaret() const; bool isRange() const; void clear(); + void setCaretVisible(bool caretIsVisible); void setCaretBlinkingSuspended(bool suspended); FrameSelectionPrivate& priv() const { return m_private; } diff --git a/WKC/WebKit/WKC/helpers/WKCHTMLFormControlElement.h b/WKC/WebKit/WKC/helpers/WKCHTMLFormControlElement.h index 3b524c02e..a7c3d7083 100755 --- a/WKC/WebKit/WKC/helpers/WKCHTMLFormControlElement.h +++ b/WKC/WebKit/WKC/helpers/WKCHTMLFormControlElement.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2014 ACCESS CO., LTD. All rights reserved. + * Copyright (c) 2011-2017 ACCESS CO., LTD. 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 @@ -32,6 +32,7 @@ class WKC_API HTMLFormControlElement : public HTMLElement { public: void dispatchFormControlInputEvent(); void dispatchFormControlChangeEvent(); + bool isSuccessfulSubmitButton() const; HTMLFormElement* form() const; diff --git a/WKC/WebKit/WKC/helpers/WKCResourceHandle.h b/WKC/WebKit/WKC/helpers/WKCResourceHandle.h index b97919e36..35b87ba81 100755 --- a/WKC/WebKit/WKC/helpers/WKCResourceHandle.h +++ b/WKC/WebKit/WKC/helpers/WKCResourceHandle.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2014 ACCESS CO., LTD. All rights reserved. + * Copyright (c) 2011-2016 ACCESS CO., LTD. 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 @@ -40,6 +40,7 @@ class WKC_API ResourceHandle { int contentComposition() const; void* httphandle(); + bool isSSL() const; bool isEVSSL() const; int secureState() const; int secureLevel() const; diff --git a/WKC/WebKit/WKC/helpers/privates/WKCFocusController.cpp b/WKC/WebKit/WKC/helpers/privates/WKCFocusController.cpp index 73f0e72d0..90c5e247e 100755 --- a/WKC/WebKit/WKC/helpers/privates/WKCFocusController.cpp +++ b/WKC/WebKit/WKC/helpers/privates/WKCFocusController.cpp @@ -63,15 +63,16 @@ FocusControllerPrivate::focusedOrMainFrame() } Element* -FocusControllerPrivate::findNextFocusableElement(const FocusDirection& direction, const WKCRect* scope) +FocusControllerPrivate::findNextFocusableElement(const FocusDirection& direction, const WKCRect* scope, Element* base) { WebCore::FocusDirection webcore_dir = toWebCoreFocusDirection(direction); WebCore::Element* element; + WebCore::Element* baseWebCore = base ? ((WebCore::Element*)(((NodePrivate&)(((Node*)base)->priv())).webcore())) : nullptr; if (scope) { WebCore::IntRect r(scope->fX, scope->fY, scope->fWidth, scope->fHeight); - element = m_webcore->findNextFocusableElement(webcore_dir, &r); + element = m_webcore->findNextFocusableElement(webcore_dir, &r, baseWebCore); } else { - element = m_webcore->findNextFocusableElement(webcore_dir, 0); + element = m_webcore->findNextFocusableElement(webcore_dir, 0, baseWebCore); } if (!element) return 0; @@ -141,9 +142,9 @@ FocusController::focusedOrMainFrame() return m_private.focusedOrMainFrame(); } -Element* FocusController::findNextFocusableElement(const FocusDirection& direction, const WKCRect* scope) +Element* FocusController::findNextFocusableElement(const FocusDirection& direction, const WKCRect* scope, Element* base) { - return m_private.findNextFocusableElement(direction, scope); + return m_private.findNextFocusableElement(direction, scope, base); } Element* diff --git a/WKC/WebKit/WKC/helpers/privates/WKCFocusControllerPrivate.h b/WKC/WebKit/WKC/helpers/privates/WKCFocusControllerPrivate.h index 401c21ec7..29d29f2bc 100755 --- a/WKC/WebKit/WKC/helpers/privates/WKCFocusControllerPrivate.h +++ b/WKC/WebKit/WKC/helpers/privates/WKCFocusControllerPrivate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2015 ACCESS CO., LTD. All rights reserved. + * Copyright (c) 2011-2016 ACCESS CO., LTD. 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 @@ -47,7 +47,7 @@ WTF_MAKE_FAST_ALLOCATED; WebCore::FocusController* webcore() const { return m_webcore; } FocusController& wkc() { return m_wkc; } - Element* findNextFocusableElement(const FocusDirection& direction, const WKCRect* scope = 0); + Element* findNextFocusableElement(const FocusDirection& direction, const WKCRect* scope = 0, Element* base = 0); Element* findNearestFocusableElementFromPoint(const WKCPoint& point, const WKCRect* scope = 0); Frame* focusedOrMainFrame(); diff --git a/WKC/WebKit/WKC/helpers/privates/WKCFrameSelection.cpp b/WKC/WebKit/WKC/helpers/privates/WKCFrameSelection.cpp index ef69f1995..ee0f75d87 100755 --- a/WKC/WebKit/WKC/helpers/privates/WKCFrameSelection.cpp +++ b/WKC/WebKit/WKC/helpers/privates/WKCFrameSelection.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 ACCESS CO., LTD. All rights reserved. + * Copyright (c) 2011-2017 ACCESS CO., LTD. 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 @@ -61,6 +61,12 @@ FrameSelectionPrivate::clear() m_webcore->clear(); } +void +FrameSelectionPrivate::setCaretVisible(bool caretIsVisible) +{ + m_webcore->setCaretVisible(caretIsVisible); +} + void FrameSelectionPrivate::setCaretBlinkingSuspended(bool suspended) { @@ -102,6 +108,12 @@ FrameSelection::clear() m_private.clear(); } +void +FrameSelection::setCaretVisible(bool caretIsVisible) +{ + m_private.setCaretVisible(caretIsVisible); +} + void FrameSelection::setCaretBlinkingSuspended(bool suspended) { diff --git a/WKC/WebKit/WKC/helpers/privates/WKCFrameSelectionPrivate.h b/WKC/WebKit/WKC/helpers/privates/WKCFrameSelectionPrivate.h index 49c031eda..3dd4b98f4 100755 --- a/WKC/WebKit/WKC/helpers/privates/WKCFrameSelectionPrivate.h +++ b/WKC/WebKit/WKC/helpers/privates/WKCFrameSelectionPrivate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2016 ACCESS CO., LTD. All rights reserved. + * Copyright (c) 2011-2017 ACCESS CO., LTD. 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 @@ -50,6 +50,7 @@ class FrameSelectionPrivate { bool isCaret() const; bool isRange() const; void clear(); + void setCaretVisible(bool caretIsVisible); void setCaretBlinkingSuspended(bool suspended); private: diff --git a/WKC/WebKit/WKC/helpers/privates/WKCHTMLFormControlElement.cpp b/WKC/WebKit/WKC/helpers/privates/WKCHTMLFormControlElement.cpp index ece389578..05110e210 100755 --- a/WKC/WebKit/WKC/helpers/privates/WKCHTMLFormControlElement.cpp +++ b/WKC/WebKit/WKC/helpers/privates/WKCHTMLFormControlElement.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2015 ACCESS CO., LTD. All rights reserved. + * Copyright (c) 2011-2017 ACCESS CO., LTD. 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 @@ -70,6 +70,12 @@ HTMLFormControlElementPrivate::dispatchFormControlChangeEvent() webcore()->dispatchFormControlChangeEvent(); } +bool +HTMLFormControlElementPrivate::isSuccessfulSubmitButton() const +{ + return webcore()->isSuccessfulSubmitButton(); +} + //////////////////////////////////////////////////////////////////////////////// HTMLFormControlElement::HTMLFormControlElement(HTMLFormControlElementPrivate& parent) @@ -89,6 +95,12 @@ HTMLFormControlElement::dispatchFormControlChangeEvent() return static_cast(priv()).dispatchFormControlChangeEvent(); } +bool +HTMLFormControlElement::isSuccessfulSubmitButton() const +{ + return static_cast(priv()).isSuccessfulSubmitButton(); +} + HTMLFormElement* HTMLFormControlElement::form() const { diff --git a/WKC/WebKit/WKC/helpers/privates/WKCHTMLFormControlElementPrivate.h b/WKC/WebKit/WKC/helpers/privates/WKCHTMLFormControlElementPrivate.h index 46841ad10..884006d4e 100755 --- a/WKC/WebKit/WKC/helpers/privates/WKCHTMLFormControlElementPrivate.h +++ b/WKC/WebKit/WKC/helpers/privates/WKCHTMLFormControlElementPrivate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2015 ACCESS CO., LTD. All rights reserved. + * Copyright (c) 2011-2017 ACCESS CO., LTD. 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 @@ -50,6 +50,7 @@ WTF_MAKE_FAST_ALLOCATED; void dispatchFormControlInputEvent(); void dispatchFormControlChangeEvent(); + bool isSuccessfulSubmitButton() const; private: HTMLFormControlElementWrap m_wkc; diff --git a/WKC/WebKit/WKC/helpers/privates/WKCResourceHandle.cpp b/WKC/WebKit/WKC/helpers/privates/WKCResourceHandle.cpp index 217a5b73c..2e9795a71 100755 --- a/WKC/WebKit/WKC/helpers/privates/WKCResourceHandle.cpp +++ b/WKC/WebKit/WKC/helpers/privates/WKCResourceHandle.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2015 ACCESS CO., LTD. All rights reserved. + * Copyright (c) 2011-2016 ACCESS CO., LTD. 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 @@ -107,6 +107,15 @@ ResourceHandlePrivate::httphandle() return i->m_handle; } +bool +ResourceHandlePrivate::isSSL() const +{ + WebCore::ResourceHandleInternal* i = m_webcore->getInternal(); + if (!i) + return 0; + return i->m_isSSL; +} + bool ResourceHandlePrivate::isEVSSL() const { @@ -202,6 +211,12 @@ ResourceHandle::httphandle() return m_private.httphandle(); } +bool +ResourceHandle::isSSL() const +{ + return m_private.isSSL(); +} + bool ResourceHandle::isEVSSL() const { diff --git a/WKC/WebKit/WKC/helpers/privates/WKCResourceHandlePrivate.h b/WKC/WebKit/WKC/helpers/privates/WKCResourceHandlePrivate.h index 3119bcd08..2d57ebbad 100755 --- a/WKC/WebKit/WKC/helpers/privates/WKCResourceHandlePrivate.h +++ b/WKC/WebKit/WKC/helpers/privates/WKCResourceHandlePrivate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2015 ACCESS CO., LTD. All rights reserved. + * Copyright (c) 2011-2016 ACCESS CO., LTD. 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 @@ -57,6 +57,7 @@ WTF_MAKE_FAST_ALLOCATED; int contentComposition() const; void* httphandle(); + bool isSSL() const; bool isEVSSL() const; int secureState() const; int secureLevel() const; diff --git a/WKC/WebKit/WKC/webkit/WKCVersion.h b/WKC/WebKit/WKC/webkit/WKCVersion.h index 8090a9ec6..41c13f5c7 100755 --- a/WKC/WebKit/WKC/webkit/WKCVersion.h +++ b/WKC/WebKit/WKC/webkit/WKCVersion.h @@ -1,7 +1,7 @@ /* * WKCWebVersion.h * - * Copyright (c) 2011-2016 ACCESS CO., LTD. All rights reserved. + * Copyright (c) 2011-2017 ACCESS CO., LTD. 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 @@ -29,7 +29,7 @@ #define WKC_VERSION_CHECK(major, minor, micro) \ (((major)*10000) + ((minor)*100) + (micro)) >= ((WKC_VERSION_MAJOR*10000) + (WKC_VERSION_MINOR*100) + (WKC_VERSION_MICRO)) -#define WKC_CUSTOMER_RELEASE_VERSION "0.4.25" +#define WKC_CUSTOMER_RELEASE_VERSION "0.5.10" #define WKC_WEBKIT_VERSION "601.6" diff --git a/WKC/WebKit/WKC/webkit/WKCWebView.cpp b/WKC/WebKit/WKC/webkit/WKCWebView.cpp index 08f5d0704..d1505fab0 100755 --- a/WKC/WebKit/WKC/webkit/WKCWebView.cpp +++ b/WKC/WebKit/WKC/webkit/WKCWebView.cpp @@ -11,7 +11,7 @@ Copyright (C) 2009 Igalia S.L. Copyright (C) 2009 Movial Creative Technologies Inc. Copyright (C) 2009 Bobby Powers - Copyright (c) 2010-2016 ACCESS CO., LTD. All rights reserved. + Copyright (c) 2010-2017 ACCESS CO., LTD. All rights reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -200,6 +200,8 @@ #include "bindings/generic/RuntimeEnabledFeatures.h" +#include "shadow/SliderThumbElement.h" + #if ENABLE(CONTENT_EXTENSIONS) #include "ContentExtensionCompiler.h" #endif @@ -320,8 +322,6 @@ WKCWebViewPrivate::WKCWebViewPrivate(WKCWebView* parent, WKCClientBuilders& buil m_focusedElement = 0; m_elementFromPoint = 0; - m_lastNodeUnderMouse = 0; - #if ENABLE(REMOTE_INSPECTOR) m_inspectorServerClient = 0; m_inspectorIsEnabled = false; @@ -1696,12 +1696,10 @@ WKCWebView::notifyMouseMoveTest(const WKCPoint& pos, WKC::MouseButton button, Mo coreNode = node ? node->priv().webcore() : 0; linkNode = coreNode ? coreNode->enclosingLinkEventParentOrSelf() : 0; - if (!coreNode || coreNode == m_private->m_lastNodeUnderMouse || !linkNode) + if (!coreNode || !linkNode) return notifyMouseMove(pos, button, modifiers); - m_private->m_lastNodeUnderMouse = coreNode; - - renderer = coreNode->renderer(); + renderer = linkNode->renderer(); if (renderer && WTF::is(renderer)) { renderer = ((WebCore::RenderElement *)renderer)->hoverAncestor(); } else { @@ -1715,7 +1713,7 @@ WKCWebView::notifyMouseMoveTest(const WKCPoint& pos, WKC::MouseButton button, Mo if (!renderer || !targetNode) return notifyMouseMove(pos, button, modifiers); - for (WebCore::Node* n = coreNode; n && n != targetNode; n = n->parentNode()) { + for (WebCore::Node* n = linkNode; n && n != targetNode; n = n->parentNode()) { if (n->hasEventListeners(WebCore::eventNames().mouseoverEvent) && n->hasEventListeners(WebCore::eventNames().mousemoveEvent)) { contentChanged = true; @@ -1757,7 +1755,7 @@ WKCWebView::notifyMouseMoveTest(const WKCPoint& pos, WKC::MouseButton button, Mo renderer = targetNode->renderer(); - for (WebCore::Node* n = coreNode; n && n != targetNode; n = n->parentNode()) { + for (WebCore::Node* n = linkNode; n && n != targetNode; n = n->parentNode()) { if (n->hasEventListeners(WebCore::eventNames().mouseoverEvent) && n->hasEventListeners(WebCore::eventNames().mousemoveEvent)) { contentChanged = true; @@ -2472,6 +2470,26 @@ WKCWebView::executeScript(const char* script) m_private->core()->mainFrame().script().executeScript(WTF::String::fromUTF8(script), true); } +void +WKCWebView::getSelectionPosition(int& startOffset, int& endOffset) const +{ + startOffset = -1; + endOffset = -1; + + WebCore::Frame* frame = (WebCore::Frame *)&m_private->core()->focusController().focusedOrMainFrame(); + if (!frame) + return; + WebCore::FrameSelection& selection = frame->selection(); + if (!selection.isCaretOrRange()) + return; + WTF::RefPtr range = selection.toNormalizedRange(); + if (!range) + return; + + startOffset = range->startOffset(); + endOffset = range->endOffset(); +} + bool WKCWebView::hasSelection() { @@ -3642,9 +3660,9 @@ WKCWebKitCancelWakeUp(void* in_timer) } WKC_API void -WKCWebKitWakeUp(void* in_opaque) +WKCWebKitWakeUp(void* in_timer, void* in_data) { - //wkcTimerWakeUpPeer(in_opaque); + wkcTimerWakeUpPeer(in_timer, in_data); } unsigned int @@ -3673,6 +3691,15 @@ WKCWebKitIsMemoryCrashing() static void WKCResetVariables(); +#define DEFAULT_WATCHDOG_INTERVAL std::chrono::duration_cast(std::chrono::seconds(20)) +std::chrono::microseconds gWatchdogInterval = DEFAULT_WATCHDOG_INTERVAL; + +void +WKCWebKitSetWatchdogInterval(int in_interval_ms) +{ + gWatchdogInterval = std::chrono::duration_cast(std::chrono::milliseconds(in_interval_ms)); +} + static bool shouldInterruptJavaScript(JSC::ExecState*, void*, void*) { @@ -3681,7 +3708,6 @@ shouldInterruptJavaScript(JSC::ExecState*, void*, void*) return gValidViews->first()->core()->chrome().client().shouldInterruptJavaScript(); } - bool WKCWebKitInitialize(void* memory, unsigned int memory_size, void* font_memory, unsigned int font_memory_size, WKCMemoryEventHandler& memory_event_handler, WKCTimerEventHandler& timer_event_handler) { @@ -3794,7 +3820,7 @@ WKCWebKitInitialize(void* memory, unsigned int memory_size, void* font_memory, u JSC::JSLockHolder locker(&vm); if (!vm.watchdog) vm.watchdog = std::make_unique(); - vm.watchdog->setTimeLimit(vm, std::chrono::duration_cast(std::chrono::duration(20)), shouldInterruptJavaScript, 0, 0); + vm.watchdog->setTimeLimit(vm, gWatchdogInterval, shouldInterruptJavaScript, 0, 0); NX_DP(("WKCWebKitInitialize Exit\n")); return true; @@ -3859,6 +3885,7 @@ WKCWebKitFinalize() DeleteCriticalSection(&gCriticalSection); gCriticalSectionFlag = false; #endif + gWatchdogInterval = DEFAULT_WATCHDOG_INTERVAL; } bool @@ -4318,6 +4345,7 @@ WKCWebKitForceTerminate() wkcDebugPrintForceTerminatePeer(); memset(gTimerEventHandler, 0, sizeof(WKCWebKitTimerEventHandler)); memset(gMemoryEventHandler, 0, sizeof(WKCWebKitMemoryEventHandler)); + gWatchdogInterval = DEFAULT_WATCHDOG_INTERVAL; NX_DP(("WKCWebKitForceTerminate Exit\n")); } @@ -4567,7 +4595,7 @@ WKCWebView::scrollNodeBy(WKC::Node* node, int dx, int dy) if (renderer->hasOverflowClip() && isLineClampNoneByParent) { int offsetX = layer->scrollXOffset() + dx; int offsetY = layer->scrollYOffset() + dy; - layer->scrollToOffset(WebCore::IntSize(offsetX, offsetY)); + layer->scrollToOffset(WebCore::IntSize(offsetX, offsetY), WebCore::RenderLayer::ScrollOffsetClamping::ScrollOffsetClamped); WebCore::Frame* frame = &renderer->frame(); if (frame) { @@ -5148,6 +5176,24 @@ WKCWebkitSetThreadPriorityCallback(WKC::SetThreadPriorityProc in_proc) wkcThreadSetThreadPriorityProcPeer(in_proc); } +// cancel range input dragging mode. + +void +WKCWebKitCancelRangeInputDragging() +{ + WebCore::SliderThumbElement::cancelDragging(); +} + +// dump HTTPCache list (for Debug) + +void +WKCWebKitDumpHTTPCacheList() +{ + if (WebCore::ResourceHandleManager::isExistSharedInstance()) { + WebCore::ResourceHandleManager::sharedInstance()->dumpHTTPCacheResourceList(); + } +} + // idn namespace IDN { diff --git a/WKC/WebKit/WKC/webkit/WKCWebView.h b/WKC/WebKit/WKC/webkit/WKCWebView.h index c02ce2b83..a2f173c2d 100755 --- a/WKC/WebKit/WKC/webkit/WKCWebView.h +++ b/WKC/WebKit/WKC/webkit/WKCWebView.h @@ -1,7 +1,7 @@ /* * WKCWebView.h * - * Copyright (c) 2010-2016 ACCESS CO., LTD. All rights reserved. + * Copyright (c) 2010-2017 ACCESS CO., LTD. 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 @@ -207,7 +207,9 @@ namespace WKC { @retval "== false" Failed to initialize @details The heap memory for the browser engine must be set to a value of 10MB or higher.@n -The heap memory for the font engine must be set to an appropriate value of 256KB or higher. Considering trade-offs with performance, 512KB is the recommended value for the size. +The heap memory for the font engine must be set to an appropriate value of 256KB or higher, or 0(in case disable font engine). +Considering trade-offs with performance, 512KB is the recommended value for the size. +If font_memory and its size is 0, the font engine become disabled and no text drawn. @attention The method of setting heap memory for the font engine may change in the future. */ @@ -343,12 +345,13 @@ WKC_API void WKCWebKitSetFontNoMemoryCallback(FontNoMemoryProc proc); /** @brief Wakes up browser engine -@param data Data passed by WKCTimerEventHandler::requestWakeUp() +@param in_timer Timer passed by WKCTimerEventHandler::requestWakeUp() +@param in_data Data passed by WKCTimerEventHandler::requestWakeUp() @return None @details Wakes up the browser engine that is waiting for timer wakeup using WKCTimerEventHandler::requestWakeUp(). */ -WKC_API void WKCWebKitWakeUp(void* data); +WKC_API void WKCWebKitWakeUp(void* in_timer, void* in_data); /** @brief Get current tick count @return Current tick count @@ -879,6 +882,31 @@ Set thread priority callback. */ WKC_API void WKCWebkitSetThreadPriorityCallback(WKC::SetThreadPriorityProc in_proc); +/** +@brief Cancel dragging mode of range input element. +@details +Cancel dragging mode of range input element. +*/ +WKC_API void WKCWebKitCancelRangeInputDragging(); + +/** +@brief Sets the interval of watchdog timer in microseconds +@param in_interval interval time in microseconds +@details +This API must be called BEFORE WKC::WKCWebView::WKCWebKitInitialize is called. +*/ +WKC_API void WKCWebKitSetWatchdogInterval(int in_interval_ms); + +/** +@brief Dump HTTP Cache info. +@details +Dump HTTP Cache info. +@attention +- This API is debug use only. +*/ +WKC_API void WKCWebKitDumpHTTPCacheList(); + + /** @brief Class that corresponds to the content display screen of the browser. */ class WKC_API WKCWebView { @@ -1614,6 +1642,16 @@ class WKC_API WKCWebView @return None */ void selectAll(); + /** + @brief Gets selection positions + @param startOffset Offset of start position + @param endOffset Offset of end position + @return None + @details + Gets selection positions. + Offsets become negative when failed to get. + */ + void getSelectionPosition(int& startOffset, int& endOffset) const; /** @brief Checks if mime type can be displayed diff --git a/WKC/include/wkc/wkcmediapeer.h b/WKC/include/wkc/wkcmediapeer.h index e6f505633..353e929b3 100755 --- a/WKC/include/wkc/wkcmediapeer.h +++ b/WKC/include/wkc/wkcmediapeer.h @@ -1,7 +1,7 @@ /* * wkcmediapeer.h * - * Copyright(c) 2011-2016 ACCESS CO., LTD. All rights reserved. + * Copyright(c) 2011-2017 ACCESS CO., LTD. All rights reserved. */ #ifndef _WKC_MEDIA_PEER_H_ @@ -139,6 +139,7 @@ enum { WKC_MEDIA_PLAYERSTATE_SEEKBEGIN, WKC_MEDIA_PLAYERSTATE_SEEKEND, WKC_MEDIA_PLAYERSTATE_RESETUSERGESTURERESTRICTION, + WKC_MEDIA_PLAYERSTATE_REMOVEUSERGESTURERESTRICTION, WKC_MEDIA_PLAYERSTATES }; diff --git a/WKC/include/wkc/wkcpeer.h b/WKC/include/wkc/wkcpeer.h index a7f79184e..6a396e729 100755 --- a/WKC/include/wkc/wkcpeer.h +++ b/WKC/include/wkc/wkcpeer.h @@ -132,6 +132,16 @@ in_timer must be a value obtained by wkcTimerNewPeer(). The existing implementation can be used for this function without change. */ WKC_PEER_API void wkcTimerCancelPeer(void* in_timer); +/** +@brief +@param "in_timer" Pointer to timer object +@param "in_data" Data passed to timer +@details +Starts a timer. +@remarks +The existing implementation can be used for this function without change. +*/ +WKC_PEER_API void wkcTimerWakeUpPeer(void* in_timer, void* in_data); /* @brief @@ -842,6 +852,9 @@ enum { WKC_UNICODE_LINEBREAKCATEGORY_HL, WKC_UNICODE_LINEBREAKCATEGORY_CJ, WKC_UNICODE_LINEBREAKCATEGORY_RI, + WKC_UNICODE_LINEBREAKCATEGORY_ZWJ, + WKC_UNICODE_LINEBREAKCATEGORY_EB, + WKC_UNICODE_LINEBREAKCATEGORY_EM, WKC_UNICODE_LINEBREAKCATEGORIES, }; diff --git a/webkit/JavaScriptCore/ChangeLog b/webkit/JavaScriptCore/ChangeLog index a70ce09b8..780ed7353 100755 --- a/webkit/JavaScriptCore/ChangeLog +++ b/webkit/JavaScriptCore/ChangeLog @@ -1,3 +1,35 @@ +2016-08-29 Babak Shafiei + + Merge r204572. + + 2016-08-17 Geoffrey Garen + + Fixed a potential bug in MarkedArgumentBuffer. + https://bugs.webkit.org/show_bug.cgi?id=160948 + + + Reviewed by Oliver Hunt. + + I haven't been able to produce an observable test case after some trying. + + * runtime/ArgList.cpp: + (JSC::MarkedArgumentBuffer::addMarkSet): New helper function -- I broke + this out from existing code for clarity, but the behavior is the same. + + (JSC::MarkedArgumentBuffer::expandCapacity): Ditto. + + (JSC::MarkedArgumentBuffer::slowAppend): Always addMarkSet() on the slow + path. This is faster than the old linear scan, and I think it might + avoid cases the old scan could miss. + + * runtime/ArgList.h: + (JSC::MarkedArgumentBuffer::append): Account for the case where someone + has called clear() or removeLast(). + + (JSC::MarkedArgumentBuffer::mallocBase): No behavior change -- but it's + clearer to test the buffers directly instead of inferring what they + might be based on capacity. + 2016-05-13 Matthew Hanson Merge r196490. rdar://problem/26270811 diff --git a/webkit/JavaScriptCore/heap/IncrementalSweeper.cpp b/webkit/JavaScriptCore/heap/IncrementalSweeper.cpp index 84da0a3cc..137dadfc7 100755 --- a/webkit/JavaScriptCore/heap/IncrementalSweeper.cpp +++ b/webkit/JavaScriptCore/heap/IncrementalSweeper.cpp @@ -151,6 +151,12 @@ void IncrementalSweeper::doSweep(double sweepBeginTime) cancelTimer(); } +void IncrementalSweeper::doSweepSynchronously() +{ + while (sweepNextBlock()); + m_blocksToSweep.clear(); +} + bool IncrementalSweeper::sweepNextBlock() { while (!m_blocksToSweep.isEmpty()) { @@ -170,7 +176,12 @@ bool IncrementalSweeper::sweepNextBlock() void IncrementalSweeper::startSweeping() { - scheduleTimer(); + if (WTF::isMainThread()) { + scheduleTimer(); + } else { + // In case of worker, do sweep in worker thread. + doSweepSynchronously(); + } } void IncrementalSweeper::willFinishSweeping() diff --git a/webkit/JavaScriptCore/heap/IncrementalSweeper.h b/webkit/JavaScriptCore/heap/IncrementalSweeper.h index 7f4e2c1d9..ac3b8aafe 100755 --- a/webkit/JavaScriptCore/heap/IncrementalSweeper.h +++ b/webkit/JavaScriptCore/heap/IncrementalSweeper.h @@ -54,6 +54,9 @@ class IncrementalSweeper : public HeapTimer { #if USE(CF) || PLATFORM(WKC) private: void doSweep(double startTime); +#if PLATFORM(WKC) + void doSweepSynchronously(); +#endif void scheduleTimer(); void cancelTimer(); diff --git a/webkit/JavaScriptCore/runtime/ArgList.cpp b/webkit/JavaScriptCore/runtime/ArgList.cpp index 3023151bf..7813b404f 100755 --- a/webkit/JavaScriptCore/runtime/ArgList.cpp +++ b/webkit/JavaScriptCore/runtime/ArgList.cpp @@ -30,6 +30,19 @@ using std::min; namespace JSC { +void MarkedArgumentBuffer::addMarkSet(JSValue v) +{ + if (m_markSet) + return; + + Heap* heap = Heap::heap(v); + if (!heap) + return; + + m_markSet = &heap->markListSet(); + m_markSet->add(this); +} + void ArgList::getSlice(int startIndex, ArgList& result) const { if (startIndex <= 0 || startIndex >= m_argCount) { @@ -51,40 +64,31 @@ void MarkedArgumentBuffer::markLists(HeapRootVisitor& heapRootVisitor, ListSet& } } -void MarkedArgumentBuffer::slowAppend(JSValue v) +void MarkedArgumentBuffer::expandCapacity() { int newCapacity = (Checked(m_capacity) * 2).unsafeGet(); size_t size = (Checked(newCapacity) * sizeof(EncodedJSValue)).unsafeGet(); EncodedJSValue* newBuffer = static_cast(fastMalloc(size)); - for (int i = 0; i < m_capacity; ++i) + for (int i = 0; i < m_capacity; ++i) { newBuffer[i] = m_buffer[i]; + addMarkSet(JSValue::decode(m_buffer[i])); + } if (EncodedJSValue* base = mallocBase()) fastFree(base); m_buffer = newBuffer; m_capacity = newCapacity; +} + +void MarkedArgumentBuffer::slowAppend(JSValue v) +{ + if (m_size >= m_capacity) + expandCapacity(); slotFor(m_size) = JSValue::encode(v); ++m_size; - - if (m_markSet) - return; - - // As long as our size stays within our Vector's inline - // capacity, all our values are allocated on the stack, and - // therefore don't need explicit marking. Once our size exceeds - // our Vector's inline capacity, though, our values move to the - // heap, where they do need explicit marking. - for (int i = 0; i < m_size; ++i) { - Heap* heap = Heap::heap(JSValue::decode(slotFor(i))); - if (!heap) - continue; - - m_markSet = &heap->markListSet(); - m_markSet->add(this); - break; - } + addMarkSet(v); } } // namespace JSC diff --git a/webkit/JavaScriptCore/runtime/ArgList.h b/webkit/JavaScriptCore/runtime/ArgList.h index e328a7d1a..9302f808c 100755 --- a/webkit/JavaScriptCore/runtime/ArgList.h +++ b/webkit/JavaScriptCore/runtime/ArgList.h @@ -81,7 +81,7 @@ class MarkedArgumentBuffer { void append(JSValue v) { - if (m_size >= m_capacity) + if (m_size >= m_capacity || mallocBase()) return slowAppend(v); slotFor(m_size) = JSValue::encode(v); @@ -103,6 +103,10 @@ class MarkedArgumentBuffer { static void markLists(HeapRootVisitor&, ListSet&); private: + void expandCapacity(); + + void addMarkSet(JSValue); + JS_EXPORT_PRIVATE void slowAppend(JSValue); EncodedJSValue& slotFor(int item) const @@ -112,7 +116,7 @@ class MarkedArgumentBuffer { EncodedJSValue* mallocBase() { - if (m_capacity == static_cast(inlineCapacity)) + if (m_buffer == m_inlineBuffer) return 0; return &slotFor(0); } diff --git a/webkit/JavaScriptCore/runtime/BasicBlockLocation.h b/webkit/JavaScriptCore/runtime/BasicBlockLocation.h index 49bf51474..2b49f24f1 100755 --- a/webkit/JavaScriptCore/runtime/BasicBlockLocation.h +++ b/webkit/JavaScriptCore/runtime/BasicBlockLocation.h @@ -38,6 +38,9 @@ class CCallHelpers; class LLIntOffsetsExtractor; class BasicBlockLocation { +#if PLATFORM(WKC) + WTF_MAKE_FAST_ALLOCATED; +#endif public: typedef std::pair Gap; diff --git a/webkit/JavaScriptCore/runtime/ControlFlowProfiler.h b/webkit/JavaScriptCore/runtime/ControlFlowProfiler.h index e745b2d1e..6b88567d5 100755 --- a/webkit/JavaScriptCore/runtime/ControlFlowProfiler.h +++ b/webkit/JavaScriptCore/runtime/ControlFlowProfiler.h @@ -90,6 +90,9 @@ struct BasicBlockRange { }; class ControlFlowProfiler { +#if PLATFORM(WKC) + WTF_MAKE_FAST_ALLOCATED; +#endif public: ControlFlowProfiler(); ~ControlFlowProfiler(); diff --git a/webkit/JavaScriptCore/runtime/SymbolTable.h b/webkit/JavaScriptCore/runtime/SymbolTable.h index 9f0bc4e43..9fb04280d 100755 --- a/webkit/JavaScriptCore/runtime/SymbolTable.h +++ b/webkit/JavaScriptCore/runtime/SymbolTable.h @@ -420,6 +420,9 @@ struct SymbolTableIndexHashTraits : HashTraits { }; class SymbolTable final : public JSCell { +#if PLATFORM(WKC) + WTF_MAKE_FAST_ALLOCATED; +#endif public: typedef JSCell Base; static const unsigned StructureFlags = Base::StructureFlags | StructureIsImmortal; @@ -667,12 +670,22 @@ class SymbolTable final : public JSCell { Map m_map; ScopeOffset m_maxScopeOffset; - + +#if PLATFORM(WKC) +public: +#endif struct TypeProfilingRareData { +#if PLATFORM(WKC) + WTF_MAKE_FAST_ALLOCATED; + public: +#endif UniqueIDMap m_uniqueIDMap; OffsetToVariableMap m_offsetToVariableMap; UniqueTypeSetMap m_uniqueTypeSetMap; }; +#if PLATFORM(WKC) +private: +#endif std::unique_ptr m_typeProfilingRareData; bool m_usesNonStrictEval; diff --git a/webkit/JavaScriptCore/runtime/TypeLocationCache.h b/webkit/JavaScriptCore/runtime/TypeLocationCache.h index 9f856666c..078d4e946 100755 --- a/webkit/JavaScriptCore/runtime/TypeLocationCache.h +++ b/webkit/JavaScriptCore/runtime/TypeLocationCache.h @@ -35,6 +35,9 @@ namespace JSC { class VM; class TypeLocationCache { +#if PLATFORM(WKC) + WTF_MAKE_FAST_ALLOCATED; +#endif public: struct LocationKey { LocationKey() {} @@ -59,7 +62,11 @@ class TypeLocationCache { std::pair getTypeLocation(GlobalVariableID, intptr_t, unsigned start, unsigned end, PassRefPtr, VM*); private: +#if !PLATFORM(WKC) typedef std::unordered_map> LocationMap; +#else + typedef std::unordered_map, std::equal_to, WKCAllocator>> LocationMap; +#endif LocationMap m_locationMap; }; diff --git a/webkit/JavaScriptCore/runtime/TypeProfiler.h b/webkit/JavaScriptCore/runtime/TypeProfiler.h index 0a95d91f2..64cc507e4 100755 --- a/webkit/JavaScriptCore/runtime/TypeProfiler.h +++ b/webkit/JavaScriptCore/runtime/TypeProfiler.h @@ -116,6 +116,9 @@ namespace JSC { class VM; class TypeProfiler { +#if PLATFORM(WKC) + WTF_MAKE_FAST_ALLOCATED; +#endif public: TypeProfiler(); void logTypesForTypeLocation(TypeLocation*, VM&); diff --git a/webkit/JavaScriptCore/runtime/TypeProfilerLog.h b/webkit/JavaScriptCore/runtime/TypeProfilerLog.h index a734b8396..1f5aac82e 100755 --- a/webkit/JavaScriptCore/runtime/TypeProfilerLog.h +++ b/webkit/JavaScriptCore/runtime/TypeProfilerLog.h @@ -39,7 +39,9 @@ namespace JSC { class TypeLocation; class TypeProfilerLog { - +#if PLATFORM(WKC) + WTF_MAKE_FAST_ALLOCATED; +#endif public: struct LogEntry { #if PLATFORM(WKC) diff --git a/webkit/JavaScriptCore/runtime/Watchdog.cpp b/webkit/JavaScriptCore/runtime/Watchdog.cpp index 5e0399cfa..69bfb1646 100755 --- a/webkit/JavaScriptCore/runtime/Watchdog.cpp +++ b/webkit/JavaScriptCore/runtime/Watchdog.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 Apple Inc. All rights reserved. + * Copyright (c) 2016 ACCESS CO.,LTD. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -91,7 +92,21 @@ bool Watchdog::didFire(ExecState* exec) { #if PLATFORM(WKC) wkcThreadCheckAlivePeer(); - wkcThreadYieldPeer(); + if (wkcThreadCurrentIsMainThreadPeer()) { + wkcThreadYieldPeer(); + } else { + // For Worker threads + // Worker threads are created at the almost same time. + // It means each watchdog fires and yields everytime at close timing. + // Then the same thread would be activated again. + // So we need to omit yield sometimes. + + // No srand() done and rand() is not thread safe + // but we just want to obtain a chance of about 50% probability. + if (rand() % 2 == 1) { + wkcThreadYieldPeer(); + } + } #endif if (m_didFire) return true; diff --git a/webkit/WebCore/ChangeLog b/webkit/WebCore/ChangeLog index 44fd9735b..46fd411f6 100755 --- a/webkit/WebCore/ChangeLog +++ b/webkit/WebCore/ChangeLog @@ -1,3 +1,42 @@ +2016-10-26 Zalan Bujtas + + Ignore out-of-flow siblings when searching for a spanner candidate. + https://bugs.webkit.org/show_bug.cgi?id=164042. + + + Reviewed by Simon Fraser. + + While searching for the spanner candidates in a flow thread, we have to take into account + whether renderers are in- or out-of-flow. + What it means is that while traversing the renderer tree to find the the candidate + renderer (next sibling/ancestor's next child in pre-order traversal), we have to check if the candidate + is in the same layout context too. + + Test: fast/multicol/crash-when-spanner-candidate-is-out-of-flow.html + + * rendering/RenderMultiColumnFlowThread.cpp: + (WebCore::spannerPlacehoderCandidate): + (WebCore::RenderMultiColumnFlowThread::processPossibleSpannerDescendant): + +2016-10-22 Myles C. Maxfield + + ASSERTION FAILED: m_fonts in &WebCore::FontCascade::primaryFont + https://bugs.webkit.org/show_bug.cgi?id=163459 + + Reviewed by Darin Adler. + + The CSS Units and Values spec states that font-relative units, when used + in the font-size property, are resolved against the parent element. When + calc() is specified, we were trying to resolve them against the current + element, which is impossible because of the circular dependency. Instead, + we should resolve against the parent style the same way as when calc() + isn't specified. + + Test: fast/text/font-size-calc.html + + * css/StyleBuilderCustom.h: + (WebCore::StyleBuilderCustom::applyValueFontSize): + 2016-09-09 Chris Dumez Regression(r186020): Null dereference in getStartDate() diff --git a/webkit/WebCore/css/StyleBuilderCustom.h b/webkit/WebCore/css/StyleBuilderCustom.h index 6deffc7b2..6624e9e04 100755 --- a/webkit/WebCore/css/StyleBuilderCustom.h +++ b/webkit/WebCore/css/StyleBuilderCustom.h @@ -1632,9 +1632,11 @@ inline void StyleBuilderCustom::applyValueFontSize(StyleResolver& styleResolver, styleResolver.state().setFontSizeHasViewportUnits(primitiveValue.isViewportPercentageLength()); } else if (primitiveValue.isPercentage()) size = (primitiveValue.getFloatValue() * parentSize) / 100.0f; - else if (primitiveValue.isCalculatedPercentageWithLength()) - size = primitiveValue.cssCalcValue()->createCalculationValue(styleResolver.state().cssToLengthConversionData().copyWithAdjustedZoom(1.0f))->evaluate(parentSize); - else + else if (primitiveValue.isCalculatedPercentageWithLength()) { + const auto& conversionData = styleResolver.state().cssToLengthConversionData(); + CSSToLengthConversionData parentConversionData{ styleResolver.parentStyle(), conversionData.rootStyle(), styleResolver.document().renderView(), 1.0f, true }; + size = primitiveValue.cssCalcValue()->createCalculationValue(parentConversionData)->evaluate(parentSize); + } else return; } diff --git a/webkit/WebCore/css/StyleSheetContents.cpp b/webkit/WebCore/css/StyleSheetContents.cpp index 60c5d3966..cce72f370 100755 --- a/webkit/WebCore/css/StyleSheetContents.cpp +++ b/webkit/WebCore/css/StyleSheetContents.cpp @@ -1,6 +1,7 @@ /* * (C) 1999-2003 Lars Knoll (knoll@kde.org) * Copyright (C) 2004, 2006, 2007, 2012, 2013 Apple Inc. All rights reserved. + * Copyright (c) 2016 ACCESS CO.,LTD. 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 @@ -488,7 +489,11 @@ bool StyleSheetContents::traverseSubresources(const std::functionrenderer(); if (o) { - IntRect rect = o->absoluteBoundingBoxRect(false); + IntRect rect = o->absoluteBoundingBoxRect(true); if (!rect.isEmpty() && !(rect.x() < 0 || rect.y() < 0)) { if (element->firstChild()) { element->getNodeCompositeRect(rects, tx, ty); diff --git a/webkit/WebCore/html/HTMLMediaElement.cpp b/webkit/WebCore/html/HTMLMediaElement.cpp index c494ef9e6..4ff92a34f 100755 --- a/webkit/WebCore/html/HTMLMediaElement.cpp +++ b/webkit/WebCore/html/HTMLMediaElement.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2007-2015 Apple Inc. All rights reserved. - * Copyright (c) 2015-2016 ACCESS CO., LTD. All rights reserved. + * Copyright (c) 2015-2017 ACCESS CO., LTD. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -4760,6 +4760,18 @@ void HTMLMediaElement::mediaPlayerResetUserGestureRestriction(MediaPlayer*) endProcessingMediaPlayerCallback(); } +void HTMLMediaElement::mediaPlayerRemoveUserGestureRestriction(MediaPlayer*) +{ + LOG(Media, "HTMLMediaElement::mediaPlayerRemoveUserGestureRestriction"); + + if (!m_player) + return; + + beginProcessingMediaPlayerCallback(); + m_mediaSession->removeBehaviorRestriction(MediaElementSession::RequireUserGestureForRateChange); + endProcessingMediaPlayerCallback(); +} + bool HTMLMediaElement::canPrepareForLoad() { if (m_formatErrorSrc.isEmpty()) diff --git a/webkit/WebCore/html/HTMLMediaElement.h b/webkit/WebCore/html/HTMLMediaElement.h index 11b1c9f2a..aa30d429d 100755 --- a/webkit/WebCore/html/HTMLMediaElement.h +++ b/webkit/WebCore/html/HTMLMediaElement.h @@ -550,6 +550,7 @@ class HTMLMediaElement virtual void mediaPlayerSeekBegin(MediaPlayer*); virtual void mediaPlayerSeekEnd(MediaPlayer*); virtual void mediaPlayerResetUserGestureRestriction(MediaPlayer*); + virtual void mediaPlayerRemoveUserGestureRestriction(MediaPlayer*); #endif #if ENABLE(ENCRYPTED_MEDIA) diff --git a/webkit/WebCore/html/shadow/SliderThumbElement.cpp b/webkit/WebCore/html/shadow/SliderThumbElement.cpp index 4d58b5175..44fc692ce 100755 --- a/webkit/WebCore/html/shadow/SliderThumbElement.cpp +++ b/webkit/WebCore/html/shadow/SliderThumbElement.cpp @@ -1,6 +1,7 @@ /* * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. * Copyright (C) 2010 Google Inc. All rights reserved. + * Copyright (c) 2016 ACCESS CO., LTD. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -55,6 +56,10 @@ namespace WebCore { using namespace HTMLNames; +#if PLATFORM(WKC) +WKC_DEFINE_GLOBAL_CLASS_OBJ(bool, SliderThumbElement, s_isCancelDragging, false); +#endif + inline static Decimal sliderPosition(HTMLInputElement* element) { const StepRange stepRange(element->createStepRange(RejectAny)); @@ -317,6 +322,9 @@ void SliderThumbElement::startDragging() void SliderThumbElement::stopDragging() { +#if PLATFORM(WKC) + s_isCancelDragging = false; +#endif if (!m_inDragMode) return; @@ -334,6 +342,12 @@ void SliderThumbElement::stopDragging() #if !PLATFORM(IOS) void SliderThumbElement::defaultEventHandler(Event* event) { +#if PLATFORM(WKC) + if (s_isCancelDragging) { + stopDragging(); + } +#endif + if (!is(*event)) { HTMLDivElement::defaultEventHandler(event); return; diff --git a/webkit/WebCore/html/shadow/SliderThumbElement.h b/webkit/WebCore/html/shadow/SliderThumbElement.h index 48ecd5526..4be0e5ec9 100755 --- a/webkit/WebCore/html/shadow/SliderThumbElement.h +++ b/webkit/WebCore/html/shadow/SliderThumbElement.h @@ -1,6 +1,7 @@ /* * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. * Copyright (C) 2010 Google Inc. All rights reserved. + * Copyright (c) 2016 ACCESS CO., LTD. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -105,6 +106,13 @@ class SliderThumbElement final : public HTMLDivElement { unsigned m_exclusiveTouchIdentifier; bool m_isRegisteredAsTouchEventListener; #endif + +#if PLATFORM(WKC) +private: + WKC_DEFINE_GLOBAL_CLASS_OBJ_ENTRY(bool, s_isCancelDragging); +public: + static void cancelDragging() { s_isCancelDragging = true; } +#endif }; inline Ref SliderThumbElement::create(Document& document) diff --git a/webkit/WebCore/loader/DocumentLoader.cpp b/webkit/WebCore/loader/DocumentLoader.cpp index bb85ef7b7..9d9ffc96e 100755 --- a/webkit/WebCore/loader/DocumentLoader.cpp +++ b/webkit/WebCore/loader/DocumentLoader.cpp @@ -383,11 +383,6 @@ void DocumentLoader::notifyFinished(CachedResource* resource) ASSERT(m_mainResource); if (!m_mainResource->errorOccurred() && !m_mainResource->wasCanceled()) { finishedLoading(m_mainResource->loadFinishTime()); -#if PLATFORM(WKC) - if (m_frame) { - MemoryCache::singleton().remove(*m_mainResource); - } -#endif return; } @@ -450,7 +445,11 @@ void DocumentLoader::finishedLoading(double finishTime) // If the document specified an application cache manifest, it violates the author's intent if we store it in the memory cache // and deny the appcache the chance to intercept it in the future, so remove from the memory cache. if (m_frame) { +#if !PLATFORM(WKC) if (m_mainResource && m_frame->document()->hasManifest()) +#else + if (m_mainResource) +#endif MemoryCache::singleton().remove(*m_mainResource); } m_applicationCacheHost->finishedLoadingMainResource(); diff --git a/webkit/WebCore/page/FocusController.cpp b/webkit/WebCore/page/FocusController.cpp index 714e11f9c..b330d12ef 100755 --- a/webkit/WebCore/page/FocusController.cpp +++ b/webkit/WebCore/page/FocusController.cpp @@ -1,7 +1,7 @@ /* * Copyright (C) 2006, 2007, 2013 Apple Inc. All rights reserved. * Copyright (C) 2008 Nuanti Ltd. - * Copyright (C) 2012-2016 ACCESS CO., LTD. All rights reserved. + * Copyright (C) 2012-2017 ACCESS CO., LTD. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -67,6 +67,7 @@ #if PLATFORM(WKC) #include "ElementIterator.h" +#include "HTMLLabelElement.h" #endif namespace WebCore { @@ -731,18 +732,24 @@ static bool isFocusControlBannedElement(const FocusCandidate& candidate) MainFrame& mainFrame = document.page()->mainFrame(); FrameView* mainView = mainFrame.view(); + if (!candidate.visibleNode->isElementNode()) { + ASSERT_NOT_REACHED(); + return false; + } + Element& candidateElement = downcast(*candidate.visibleNode); + IntRect frameRect = view->frameRect(); if (view->parent()) frameRect = view->parent()->contentsToWindow(frameRect); Vector quads; - candidate.visibleNode->renderer()->absoluteQuads(quads); + candidateElement.renderer()->absoluteQuads(quads); size_t n = quads.size(); LayoutRect candidateRect = candidate.rect; for (size_t i = 0; i < n; ++i) { if (n != 1) - candidateRect = rectToAbsoluteCoordinates(candidate.visibleNode->document().frame(), quads[i].enclosingBoundingBox()); + candidateRect = rectToAbsoluteCoordinates(candidateElement.document().frame(), quads[i].enclosingBoundingBox()); if (candidateRect.isEmpty()) continue; @@ -756,12 +763,25 @@ static bool isFocusControlBannedElement(const FocusCandidate& candidate) candidateRect = mainView->windowToContents(rect); HitTestResult result = mainFrame.eventHandler().hitTestResultAtPoint(candidateRect.center(), HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::IgnoreClipping | HitTestRequest::DisallowShadowContent); + Node* hitNode = result.innerNode(); + + if (hitNode && hitNode->isTextNode()) + hitNode = hitNode->parentElement(); + + if (!hitNode) + continue; + // hit test result node is in other window. e.g. iframe - if (document != result.innerNode()->document()) + if (document != hitNode->document()) continue; + // If the hit test result node is a label and belongs to the same form as the candidate element, then allows to be focused. + if (is(*hitNode) && candidateElement.isFormControlElement()) + if (downcast(*hitNode).form() == downcast(candidateElement).form()) + return false; + // hit test result node is not in other node. - if (candidate.visibleNode->contains(result.innerNode())) + if (candidateElement.contains(hitNode)) return false; } @@ -1177,22 +1197,22 @@ static bool isScrollableContainerNode(Node* node) if (RenderObject* renderer = node->renderer()) { return (renderer->isBox() && downcast(renderer)->canBeScrolledAndHasScrollableArea() - && node->hasChildNodes() && !node->isDocumentNode()); + && node->hasChildNodes() && !node->isDocumentNode() && node->firstChild()->isElementNode()); } return false; } -void FocusController::findFocusableNodeInDirection(Node* container, const LayoutRect& startingRect, FocusDirection direction, KeyboardEvent* event, FocusCandidate& closest, const LayoutRect* scope) +void FocusController::findFocusableNodeInDirection(Node* container, Node* startingElement, const LayoutRect& startingRect, FocusDirection direction, KeyboardEvent* event, FocusCandidate& closest, const LayoutRect* scope) { ASSERT(container); - Element* focusedElement = (focusedFrame() && focusedFrame()->document()) ? focusedFrame()->document()->focusedElement() : 0; + ASSERT(startingElement); Element* element = ElementTraversal::firstWithin(*container); FocusCandidate current; current.rect = startingRect; - current.focusableNode = focusedElement; - current.visibleNode = focusedElement; + current.focusableNode = startingElement; + current.visibleNode = startingElement; current.direction = m_lastDirection; current.exitRect = m_lastExitRect; if (!m_lastEntryRect.isEmpty() && current.rect.contains(m_lastEntryRect)) @@ -1215,11 +1235,11 @@ void FocusController::findFocusableNodeInDirection(Node* container, const Layout continue; if (isScrollableContainerNode(element) && !element->renderer()->isTextArea()) { - findFocusableNodeInDirection(element, current.rect, direction, event, closest, scope); + findFocusableNodeInDirection(element, startingElement, current.rect, direction, event, closest, scope); continue; } - if (element == focusedElement) + if (element == startingElement) continue; if (!element->isKeyboardFocusable(event) && !element->isFrameOwnerElement() && !canScrollInDirection(element, direction)) @@ -1237,7 +1257,7 @@ void FocusController::findFocusableNodeInDirection(Node* container, const Layout if (!frameElement->contentFrame()) continue; frameElement->contentFrame()->document()->updateLayoutIgnorePendingStylesheets(); - findFocusableNodeInDirection(frameElement->contentFrame()->document(), current.rect, direction, event, closest, scope); + findFocusableNodeInDirection(frameElement->contentFrame()->document(), startingElement, current.rect, direction, event, closest, scope); } } if (closest.focusableNode && closest.focusableNode->isElementNode() && closest.distance != maxDistance()) { @@ -1267,7 +1287,9 @@ findFirstFocusableElement(Frame& frame, const LayoutRect* scope) element = owner; } } else if (isScrollableContainerNode(element) && !element->renderer()->isTextArea()) { - element = ElementTraversal::firstChild(*element); + Element* child = ElementTraversal::firstChild(*element); + if (child) + element = child; } if (element->isFocusable() && !element->isFrameOwnerElement()) break; @@ -1298,7 +1320,9 @@ findLastFocusableElement(Frame& frame, const LayoutRect* scope) element = owner; } } else if (isScrollableContainerNode(element) && !element->renderer()->isTextArea()) { - element = ElementTraversal::lastChild(*element); + Element* child = ElementTraversal::lastChild(*element); + if (child) + element = child; } if (element->isFocusable() && !element->isFrameOwnerElement()) break; @@ -1310,7 +1334,7 @@ findLastFocusableElement(Frame& frame, const LayoutRect* scope) return 0; } -Element* FocusController::findNextFocusableElement(const FocusDirection& direction, const IntRect* scope) +Element* FocusController::findNextFocusableElement(const FocusDirection& direction, const IntRect* scope, Element* base) { Frame& frame = focusedOrMainFrame(); Document* focusedDocument = frame.document(); @@ -1321,8 +1345,10 @@ Element* FocusController::findNextFocusableElement(const FocusDirection& directi LayoutRect scopeRect(0,0,0,0); - Element* focusedElement = focusedDocument->focusedElement(); - if (!focusedElement) { + if (!base) { + base = focusedDocument->focusedElement(); + } + if (!base) { if (scope && !scope->isEmpty()) { LayoutRect lr = m_page.mainFrame().view()->windowToContents(*scope); scopeRect = lr; @@ -1337,10 +1363,10 @@ Element* FocusController::findNextFocusableElement(const FocusDirection& directi } LayoutRect startingRect; - if (!hasOffscreenRect(focusedElement)) { - startingRect = nodeRectInAbsoluteCoordinates(focusedElement, true /* ignore border */); - } else if (focusedElement->hasTagName(areaTag)) { - startingRect = virtualRectForAreaElementAndDirection(downcast(focusedElement), direction); + if (!hasOffscreenRect(static_cast(base))) { + startingRect = nodeRectInAbsoluteCoordinates(base, true /* ignore border */); + } else if (base->hasTagName(areaTag)) { + startingRect = virtualRectForAreaElementAndDirection(downcast(base), direction); } FocusCandidate focusCandidate; @@ -1349,7 +1375,7 @@ Element* FocusController::findNextFocusableElement(const FocusDirection& directi LayoutRect lr = nframe.view()->windowToContents(*scope); scopeRect = lr; } - findFocusableNodeInDirection(nframe.document(), startingRect, direction, 0, focusCandidate, &scopeRect); + findFocusableNodeInDirection(nframe.document(), base, startingRect, direction, 0, focusCandidate, &scopeRect); ASSERT(!frameOwnerElement(focusCandidate)); Node* node = focusCandidate.focusableNode; @@ -1462,7 +1488,7 @@ static Element* findVerticallyFocusableElement(FocusDirection direction, Element if (!frameView) { return 0; } - LayoutRect scopeRect = element->renderer()->absoluteBoundingBoxRect(); + LayoutRect scopeRect = element->renderer()->absoluteBoundingBoxRect(true); if (scope && !scope->isEmpty()) scopeRect.intersect(*scope); @@ -1559,7 +1585,6 @@ FocusController::findNearestFocusableElementFromPoint(const IntPoint& point, con for (; element; element = findVerticallyFocusableElement(FocusDirectionDown, ElementTraversal::next(*element), 0, &scopeRect)) { if (!element->isKeyboardFocusable(0)) continue; -#if PLATFORM(WKC) FocusCandidate candidate = FocusCandidate(element, FocusDirectionDown); if (candidate.isNull()) continue; @@ -1567,7 +1592,6 @@ FocusController::findNearestFocusableElementFromPoint(const IntPoint& point, con continue; if (isFocusControlBannedElement(candidate)) continue; -#endif int dist = distanceBetweenElementAndPoint(element, contentsPoint); ASSERT(dist >= 0); if (dist == 0) { diff --git a/webkit/WebCore/page/FocusController.h b/webkit/WebCore/page/FocusController.h index 58789cef6..ba42a3e7b 100755 --- a/webkit/WebCore/page/FocusController.h +++ b/webkit/WebCore/page/FocusController.h @@ -97,13 +97,13 @@ class FocusController { #if PLATFORM(WKC) bool setFocusedNode(Node *node); - Element* findNextFocusableElement(const FocusDirection& direction, const IntRect* scope = 0); + Element* findNextFocusableElement(const FocusDirection& direction, const IntRect* scope = 0, Element* base = 0); Element* findNearestFocusableElementFromPoint(const IntPoint& point, const IntRect* scope = 0); #endif private: #if PLATFORM(WKC) - void findFocusableNodeInDirection(Node* container, const LayoutRect& startingRect, FocusDirection direction, KeyboardEvent* event, FocusCandidate& closest, const LayoutRect* scope); + void findFocusableNodeInDirection(Node* container, Node* startingElement, const LayoutRect& startingRect, FocusDirection direction, KeyboardEvent* event, FocusCandidate& closest, const LayoutRect* scope); #endif void setActiveInternal(bool); void setFocusedInternal(bool); diff --git a/webkit/WebCore/page/SpatialNavigation.cpp b/webkit/WebCore/page/SpatialNavigation.cpp index 9e5a82125..971edb3fb 100755 --- a/webkit/WebCore/page/SpatialNavigation.cpp +++ b/webkit/WebCore/page/SpatialNavigation.cpp @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) * Copyright (C) 2009 Antonio Gomes - * Copyright (C) 2012-2016 ACCESS CO., LTD. All rights reserved. + * Copyright (C) 2012-2017 ACCESS CO., LTD. All rights reserved. * * All rights reserved. * @@ -141,7 +141,7 @@ FocusCandidate::FocusCandidate(Node* node, FocusDirection direction) #if PLATFORM(WKC) if (visibleNode->hasTagName(HTMLNames::aTag) && visibleNode->firstChild()) { ASSERT(node->renderer()); - LayoutRect org_rect = rectToAbsoluteCoordinates(visibleNode->document().frame(), node->renderer()->absoluteBoundingBoxRect()); + LayoutRect org_rect = rectToAbsoluteCoordinates(visibleNode->document().frame(), node->renderer()->absoluteBoundingBoxRect(true)); isOrgRectEmpty = org_rect.isEmpty(); } #endif @@ -1164,6 +1164,9 @@ LayoutRect rectToAbsoluteCoordinates(Frame* initialFrame, const LayoutRect& init do { #if PLATFORM(WKC) rect.move(offsetLeft(element), offsetTop(element)); + if (element->renderer() && element->renderer()->style().position() == FixedPosition) { + rect.move(frame->tree().parent()->view()->scrollOffset()); + } #else rect.move(element->offsetLeft(), element->offsetTop()); #endif @@ -1191,10 +1194,11 @@ LayoutRect nodeRectInAbsoluteCoordinates(Node* node, bool ignoreBorder) #if PLATFORM(WKC) LayoutRect rect; if (RenderObject* renderer = node->renderer()) { - rect = rectToAbsoluteCoordinates(node->document().frame(), renderer->absoluteBoundingBoxRect()); + rect = renderer->absoluteBoundingBoxRect(true); if (node->hasTagName(HTMLNames::aTag) && node->firstChild()) { node->getNodeCompositeRect(&rect); } + rect = rectToAbsoluteCoordinates(node->document().frame(), rect); } #else LayoutRect rect; diff --git a/webkit/WebCore/platform/ScrollView.cpp b/webkit/WebCore/platform/ScrollView.cpp index c92985286..f726a6c0b 100755 --- a/webkit/WebCore/platform/ScrollView.cpp +++ b/webkit/WebCore/platform/ScrollView.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2006, 2007, 2008, 2014-2015 Apple Inc. All rights reserved. + * Copyright (c) 2017 ACCESS CO., LTD. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -827,7 +828,11 @@ void ScrollView::scrollContents(const IntSize& scrollDelta) window->invalidateContentsAndRootView(panScrollIconDirtyRect); } +#if !PLATFORM(WKC) if (canBlitOnScroll()) { // The main frame can just blit the WebView window +#else + if (canBlitOnScroll() && !parent()) { +#endif // FIXME: Find a way to scroll subframes with this faster path if (!scrollContentsFastPath(-scrollDelta, scrollViewRect, clipRect)) scrollContentsSlowPath(updateRect); diff --git a/webkit/WebCore/platform/graphics/FontCascade.cpp b/webkit/WebCore/platform/graphics/FontCascade.cpp index 2f59d7d0f..cece94b4d 100755 --- a/webkit/WebCore/platform/graphics/FontCascade.cpp +++ b/webkit/WebCore/platform/graphics/FontCascade.cpp @@ -312,7 +312,6 @@ static Ref retrieveOrAddCachedFonts(const FontDescription& fon return addResult.iterator->value->fonts.get(); auto& newEntry = addResult.iterator->value; - FontCascadeCacheKey k = WTF::move(key); newEntry = std::make_unique(WTF::move(key), FontCascadeFonts::create(fontSelector)); Ref glyphs = newEntry->fonts.get(); diff --git a/webkit/WebCore/platform/graphics/MediaPlayer.cpp b/webkit/WebCore/platform/graphics/MediaPlayer.cpp index dce6c350a..2659dd973 100755 --- a/webkit/WebCore/platform/graphics/MediaPlayer.cpp +++ b/webkit/WebCore/platform/graphics/MediaPlayer.cpp @@ -1155,6 +1155,11 @@ void MediaPlayer::resetUserGestureRestriction() { m_client.mediaPlayerResetUserGestureRestriction(this); } + +void MediaPlayer::removeUserGestureRestriction() +{ + m_client.mediaPlayerRemoveUserGestureRestriction(this); +} #endif #if ENABLE(WEB_AUDIO) diff --git a/webkit/WebCore/platform/graphics/MediaPlayer.h b/webkit/WebCore/platform/graphics/MediaPlayer.h index b75fe7af7..4ad242c59 100755 --- a/webkit/WebCore/platform/graphics/MediaPlayer.h +++ b/webkit/WebCore/platform/graphics/MediaPlayer.h @@ -209,6 +209,7 @@ class MediaPlayerClient { virtual void mediaPlayerSeekBegin(MediaPlayer*) { } virtual void mediaPlayerSeekEnd(MediaPlayer*) { } virtual void mediaPlayerResetUserGestureRestriction(MediaPlayer*) { } + virtual void mediaPlayerRemoveUserGestureRestriction(MediaPlayer*) { } #endif // whether the rendering system can accelerate the display of this MediaPlayer. @@ -472,6 +473,7 @@ class MediaPlayer : public MediaPlayerEnums { void seekBegin(); void seekEnd(); void resetUserGestureRestriction(); + void removeUserGestureRestriction(); #endif void repaint(); diff --git a/webkit/WebCore/platform/network/ResourceRequestBase.cpp b/webkit/WebCore/platform/network/ResourceRequestBase.cpp index 893f09baa..ded326182 100755 --- a/webkit/WebCore/platform/network/ResourceRequestBase.cpp +++ b/webkit/WebCore/platform/network/ResourceRequestBase.cpp @@ -32,7 +32,8 @@ namespace WebCore { #if PLATFORM(WKC) -WKC_DEFINE_GLOBAL_CLASS_OBJ(double, ResourceRequestBase, s_defaultTimeoutInterval, INT_MAX); +// We don't use WKC_DEFINE_GLOBAL_CLASS_OBJ for s_defaultTimeoutInterval because WKC_DEFINE_GLOBAL_CLASS_OBJ will reset s_defaultTimeoutInterval to 0, not to INT_MAX. +double ResourceRequestBase::s_defaultTimeoutInterval = INT_MAX; void ResourceRequestBase::forceTerminate() { diff --git a/webkit/WebCore/rendering/RenderBlock.cpp b/webkit/WebCore/rendering/RenderBlock.cpp index 1d4966fd1..e56f6c518 100755 --- a/webkit/WebCore/rendering/RenderBlock.cpp +++ b/webkit/WebCore/rendering/RenderBlock.cpp @@ -3517,11 +3517,23 @@ void RenderBlock::addFocusRingRects(Vector& rects, const LayoutPoint& a bool prevInlineHasLineBox = downcast(*inlineElementContinuation()->element()->renderer()).firstLineBox(); float topMargin = prevInlineHasLineBox ? collapsedMarginBefore() : LayoutUnit(); float bottomMargin = nextInlineHasLineBox ? collapsedMarginAfter() : LayoutUnit(); +#if !PLATFORM(WKC) LayoutRect rect(additionalOffset.x(), additionalOffset.y() - topMargin, width(), height() + topMargin + bottomMargin); if (!rect.isEmpty()) rects.append(snappedIntRect(rect)); +#else + // Add transformed rect. + FloatRect rect(0, - topMargin, width(), height() + topMargin + bottomMargin); + if (!rect.isEmpty()) + rects.append(roundedIntRect(localToContainerQuad(rect, paintContainer).boundingBox())); +#endif } else if (width() && height()) +#if !PLATFORM(WKC) rects.append(snappedIntRect(additionalOffset, size())); +#else + // Add transformed rect. + rects.append(roundedIntRect(localToContainerQuad(FloatRect(0, 0, width(), height()), paintContainer).boundingBox())); +#endif if (!hasOverflowClip() && !hasControlClip()) { if (childrenInline()) @@ -3531,13 +3543,15 @@ void RenderBlock::addFocusRingRects(Vector& rects, const LayoutPoint& a if (!is(*child) && !is(*child) && is(*child)) { auto& box = downcast(*child); FloatPoint pos; +#if PLATFORM(WKC) // get transformed position always. + pos = child->localToContainerPoint(FloatPoint(), paintContainer); +#else // FIXME: This doesn't work correctly with transforms. -#if !PLATFORM(WKC) // apply transform to focus ring on Application. if (box.layer()) pos = child->localToContainerPoint(FloatPoint(), paintContainer); else -#endif pos = FloatPoint(additionalOffset.x() + box.x(), additionalOffset.y() + box.y()); +#endif box.addFocusRingRects(rects, flooredLayoutPoint(pos), paintContainer); } } diff --git a/webkit/WebCore/rendering/RenderBlockFlow.cpp b/webkit/WebCore/rendering/RenderBlockFlow.cpp index 893004474..337977e1d 100755 --- a/webkit/WebCore/rendering/RenderBlockFlow.cpp +++ b/webkit/WebCore/rendering/RenderBlockFlow.cpp @@ -3431,7 +3431,11 @@ VisiblePosition RenderBlockFlow::positionForPoint(const LayoutPoint& point, cons } +#if !PLATFORM(WKC) void RenderBlockFlow::addFocusRingRectsForInlineChildren(Vector& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject*) +#else +void RenderBlockFlow::addFocusRingRectsForInlineChildren(Vector& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer) +#endif { ASSERT(childrenInline()); @@ -3440,9 +3444,16 @@ void RenderBlockFlow::addFocusRingRectsForInlineChildren(Vector& rects, for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) { LayoutUnit top = std::max(curr->lineTop(), curr->top()); LayoutUnit bottom = std::min(curr->lineBottom(), curr->top() + curr->height()); +#if !PLATFORM(WKC) LayoutRect rect(additionalOffset.x() + curr->x(), additionalOffset.y() + top, curr->width(), bottom - top); if (!rect.isEmpty()) rects.append(snappedIntRect(rect)); +#else + // Add transformed rect. + FloatRect rect(curr->x(), top, curr->width(), bottom - top); + if (!rect.isEmpty()) + rects.append(roundedIntRect(localToContainerQuad(rect, paintContainer).boundingBox())); +#endif } } diff --git a/webkit/WebCore/rendering/RenderBox.cpp b/webkit/WebCore/rendering/RenderBox.cpp index 33ea6d282..8253b7a08 100755 --- a/webkit/WebCore/rendering/RenderBox.cpp +++ b/webkit/WebCore/rendering/RenderBox.cpp @@ -4,7 +4,7 @@ * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) * Copyright (C) 2005-2010, 2015 Apple Inc. All rights reserved. - * Copyright (c) 2016 ACCESS CO., LTD. All rights reserved. + * Copyright (c) 2016-2017 ACCESS CO., LTD. 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 @@ -757,11 +757,20 @@ LayoutRect RenderBox::outlineBoundsForRepaint(const RenderLayerModelObject* repa return LayoutRect(snapRectToDevicePixels(box, document().deviceScaleFactor())); } +#if !PLATFORM(WKC) void RenderBox::addFocusRingRects(Vector& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject*) { if (!size().isEmpty()) rects.append(snappedIntRect(additionalOffset, size())); } +#else +void RenderBox::addFocusRingRects(Vector& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer) +{ + // Add transformed rect. + if (!size().isEmpty()) + rects.append(roundedIntRect(localToContainerQuad(FloatRect(0, 0, width(), height()), paintContainer).boundingBox())); +} +#endif int RenderBox::reflectionOffset() const { diff --git a/webkit/WebCore/rendering/RenderInline.cpp b/webkit/WebCore/rendering/RenderInline.cpp index 741841ad4..6b0755e8b 100755 --- a/webkit/WebCore/rendering/RenderInline.cpp +++ b/webkit/WebCore/rendering/RenderInline.cpp @@ -1565,19 +1565,35 @@ void RenderInline::addFocusRingRects(Vector& rects, const LayoutPoint& { #if PLATFORM(WKC) CRASH_IF_STACK_OVERFLOW(WKC_STACK_MARGIN_DEFAULT); -#endif + + { + Vector tmpRects; + LayoutPoint point; + AbsoluteRectsGeneratorContext context(tmpRects, point); + generateLineBoxRects(context); + const size_t size = tmpRects.size(); + // Add transformed rects. + for (size_t i = 0; i < size; i++) + rects.append(roundedIntRect(localToContainerQuad(FloatRect(tmpRects[i]), paintContainer).boundingBox())); + } +#else AbsoluteRectsGeneratorContext context(rects, additionalOffset); generateLineBoxRects(context); +#endif for (auto& child : childrenOfType(*this)) { if (is(child)) continue; FloatPoint pos(additionalOffset); +#if PLATFORM(WKC) // get transformed position always. + pos = child.localToContainerPoint(FloatPoint(), paintContainer); +#else // FIXME: This doesn't work correctly with transforms. if (child.hasLayer()) pos = child.localToContainerPoint(FloatPoint(), paintContainer); else if (is(child)) pos.move(downcast(child).locationOffset()); +#endif child.addFocusRingRects(rects, flooredIntPoint(pos), paintContainer); } diff --git a/webkit/WebCore/rendering/RenderLayer.cpp b/webkit/WebCore/rendering/RenderLayer.cpp index b17ddbc48..4ced18d70 100755 --- a/webkit/WebCore/rendering/RenderLayer.cpp +++ b/webkit/WebCore/rendering/RenderLayer.cpp @@ -1040,6 +1040,14 @@ TransformationMatrix RenderLayer::renderableTransform(PaintBehavior paintBehavio return matrix; } +#if PLATFORM(WKC) + if (!canRender3DTransforms()) { + TransformationMatrix matrix = *m_transform; + makeMatrixRenderable(matrix, false); + return matrix; + } +#endif + return *m_transform; } diff --git a/webkit/WebCore/rendering/RenderLayerCompositor.cpp b/webkit/WebCore/rendering/RenderLayerCompositor.cpp index d7bdac110..98b0dd730 100755 --- a/webkit/WebCore/rendering/RenderLayerCompositor.cpp +++ b/webkit/WebCore/rendering/RenderLayerCompositor.cpp @@ -2904,6 +2904,11 @@ bool RenderLayerCompositor::requiresCompositingForPosition(RenderLayerModelObjec *viewportConstrainedNotCompositedReason = RenderLayer::NotCompositedForNonViewContainer; return false; } +#if PLATFORM(WKC) + // Avoid inside frames. + if (m_renderView.document().ownerElement()) + return false; +#endif // Subsequent tests depend on layout. If we can't tell now, just keep things the way they are until layout is done. if (!m_inPostLayoutUpdate) { diff --git a/webkit/WebCore/rendering/RenderMultiColumnFlowThread.cpp b/webkit/WebCore/rendering/RenderMultiColumnFlowThread.cpp index 6680a17a7..078b4b53b 100755 --- a/webkit/WebCore/rendering/RenderMultiColumnFlowThread.cpp +++ b/webkit/WebCore/rendering/RenderMultiColumnFlowThread.cpp @@ -274,10 +274,34 @@ static bool isValidColumnSpanner(RenderMultiColumnFlowThread* flowThread, Render return false; } +static RenderObject* spannerPlacehoderCandidate(const RenderObject& renderer, const RenderMultiColumnFlowThread& stayWithin) +{ + // Spanner candidate is a next sibling/ancestor's next child within the flow thread and + // it is in the same inflow/out-of-flow layout context. + if (renderer.isOutOfFlowPositioned()) + return nullptr; + + ASSERT(renderer.isDescendantOf(&stayWithin)); + auto* current = &renderer; + while (true) { + // Skip to the first in-flow sibling. + auto* nextSibling = current->nextSibling(); + while (nextSibling && nextSibling->isOutOfFlowPositioned()) + nextSibling = nextSibling->nextSibling(); + if (nextSibling) + return nextSibling; + // No sibling candidate, jump to the parent and check its siblings. + current = current->parent(); + if (!current || current == &stayWithin || current->isOutOfFlowPositioned()) + return nullptr; + } + return nullptr; +} + RenderObject* RenderMultiColumnFlowThread::processPossibleSpannerDescendant(RenderObject*& subtreeRoot, RenderObject* descendant) { RenderBlockFlow* multicolContainer = multiColumnBlockFlow(); - RenderObject* nextRendererInFlowThread = descendant->nextInPreOrderAfterChildren(this); + RenderObject* nextRendererInFlowThread = spannerPlacehoderCandidate(*descendant, *this); RenderObject* insertBeforeMulticolChild = nullptr; RenderObject* nextDescendant = descendant; diff --git a/webkit/WebCore/rendering/RenderObject.cpp b/webkit/WebCore/rendering/RenderObject.cpp index 05edad9ec..b31d7c806 100755 --- a/webkit/WebCore/rendering/RenderObject.cpp +++ b/webkit/WebCore/rendering/RenderObject.cpp @@ -1100,7 +1100,7 @@ void RenderObject::collectSelectionRects(Vector& rects, unsigned void RenderObject::focusRingRects(Vector& rects) { - FloatPoint absPos = localToAbsolute(); + FloatPoint absPos = localToContainerPoint(FloatPoint(), nullptr); const LayoutPoint pos(absPos.x(), absPos.y()); addFocusRingRects(rects, pos); } @@ -1139,17 +1139,27 @@ IntRect RenderObject::absoluteBoundingBoxRect(bool useTransforms, bool* wasFixed void RenderObject::absoluteFocusRingQuads(Vector& quads) { Vector rects; +#if PLATFORM(WKC) + // addFocusRingRects() needs to be passed transformed offset + // because addFocusRingRects() append transformed offset always. + FloatPoint absolutePoint = localToContainerPoint(FloatPoint(), nullptr); +#else // FIXME: addFocusRingRects() needs to be passed this transform-unaware // localToAbsolute() offset here because RenderInline::addFocusRingRects() // implicitly assumes that. This doesn't work correctly with transformed // descendants. FloatPoint absolutePoint = localToAbsolute(); +#endif addFocusRingRects(rects, flooredLayoutPoint(absolutePoint)); size_t count = rects.size(); for (size_t i = 0; i < count; ++i) { IntRect rect = rects[i]; +#if PLATFORM(WKC) + quads.append(FloatQuad(rect)); +#else rect.move(-absolutePoint.x(), -absolutePoint.y()); quads.append(localToAbsoluteQuad(FloatQuad(rect))); +#endif } } diff --git a/webkit/WebCore/rendering/RenderTextControl.cpp b/webkit/WebCore/rendering/RenderTextControl.cpp index 7df383c44..860f860f1 100755 --- a/webkit/WebCore/rendering/RenderTextControl.cpp +++ b/webkit/WebCore/rendering/RenderTextControl.cpp @@ -232,11 +232,20 @@ void RenderTextControl::computePreferredLogicalWidths() setPreferredLogicalWidthsDirty(false); } +#if !PLATFORM(WKC) void RenderTextControl::addFocusRingRects(Vector& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject*) { if (!size().isEmpty()) rects.append(snappedIntRect(additionalOffset, size())); } +#else +void RenderTextControl::addFocusRingRects(Vector& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer) +{ + // Add transformed rect. + if (!size().isEmpty()) + rects.append(roundedIntRect(localToContainerQuad(FloatRect(0, 0, width(), height()), paintContainer).boundingBox())); +} +#endif RenderObject* RenderTextControl::layoutSpecialExcludedChild(bool relayoutChildren) { diff --git a/webkit/WebCore/workers/WorkerThread.cpp b/webkit/WebCore/workers/WorkerThread.cpp index f7a18de52..f59e39b1d 100755 --- a/webkit/WebCore/workers/WorkerThread.cpp +++ b/webkit/WebCore/workers/WorkerThread.cpp @@ -184,11 +184,14 @@ void WorkerThread::workerThread() } #if PLATFORM(WKC) - JSC::VM& vm = m_workerGlobalScope->vm(); - if (!vm.watchdog) - vm.watchdog = std::make_unique(); - vm.watchdog->setTimeLimit(vm, std::chrono::duration_cast(std::chrono::duration(1)), shouldTerminate, m_workerGlobalScope->script(), 0); - + { + std::chrono::milliseconds interval(100); + JSC::VM& vm = m_workerGlobalScope->vm(); + JSC::JSLockHolder locker(&vm); + if (!vm.watchdog) + vm.watchdog = std::make_unique(); + vm.watchdog->setTimeLimit(vm, std::chrono::duration_cast(interval), shouldTerminate, m_workerGlobalScope->script(), 0); + } #endif WorkerScriptController* script = m_workerGlobalScope->script(); InspectorInstrumentation::willEvaluateWorkerScript(workerGlobalScope(), m_startupData->m_startMode);