Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(547)

Side by Side Diff: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp

Issue 1839643009: RELEASE_ASSERT -> CHECK and ASSERT -> DCHECK in web. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Return DCHECK_IS_ON checks. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 ChromePrintContext(LocalFrame* frame) 279 ChromePrintContext(LocalFrame* frame)
280 : PrintContext(frame) 280 : PrintContext(frame)
281 , m_printedPageWidth(0) 281 , m_printedPageWidth(0)
282 { 282 {
283 } 283 }
284 284
285 ~ChromePrintContext() override {} 285 ~ChromePrintContext() override {}
286 286
287 virtual void begin(float width, float height) 287 virtual void begin(float width, float height)
288 { 288 {
289 ASSERT(!m_printedPageWidth); 289 DCHECK(!m_printedPageWidth);
290 m_printedPageWidth = width; 290 m_printedPageWidth = width;
291 PrintContext::begin(m_printedPageWidth, height); 291 PrintContext::begin(m_printedPageWidth, height);
292 } 292 }
293 293
294 virtual float getPageShrink(int pageNumber) const 294 virtual float getPageShrink(int pageNumber) const
295 { 295 {
296 IntRect pageRect = m_pageRects[pageNumber]; 296 IntRect pageRect = m_pageRects[pageNumber];
297 return m_printedPageWidth / pageRect.width(); 297 return m_printedPageWidth / pageRect.width();
298 } 298 }
299 299
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 void WebLocalFrameImpl::dispatchUnloadEvent() 706 void WebLocalFrameImpl::dispatchUnloadEvent()
707 { 707 {
708 if (!frame()) 708 if (!frame())
709 return; 709 return;
710 SubframeLoadingDisabler disabler(frame()->document()); 710 SubframeLoadingDisabler disabler(frame()->document());
711 frame()->loader().dispatchUnloadEvent(); 711 frame()->loader().dispatchUnloadEvent();
712 } 712 }
713 713
714 void WebLocalFrameImpl::executeScript(const WebScriptSource& source) 714 void WebLocalFrameImpl::executeScript(const WebScriptSource& source)
715 { 715 {
716 ASSERT(frame()); 716 DCHECK(frame());
717 TextPosition position(OrdinalNumber::fromOneBasedInt(source.startLine), Ordi nalNumber::first()); 717 TextPosition position(OrdinalNumber::fromOneBasedInt(source.startLine), Ordi nalNumber::first());
718 v8::HandleScope handleScope(toIsolate(frame())); 718 v8::HandleScope handleScope(toIsolate(frame()));
719 frame()->script().executeScriptInMainWorld(ScriptSourceCode(source.code, sou rce.url, position)); 719 frame()->script().executeScriptInMainWorld(ScriptSourceCode(source.code, sou rce.url, position));
720 } 720 }
721 721
722 void WebLocalFrameImpl::executeScriptInIsolatedWorld(int worldID, const WebScrip tSource* sourcesIn, unsigned numSources, int extensionGroup) 722 void WebLocalFrameImpl::executeScriptInIsolatedWorld(int worldID, const WebScrip tSource* sourcesIn, unsigned numSources, int extensionGroup)
723 { 723 {
724 ASSERT(frame()); 724 DCHECK(frame());
725 RELEASE_ASSERT(worldID > 0); 725 CHECK_GT(worldID, 0);
726 RELEASE_ASSERT(worldID < EmbedderWorldIdLimit); 726 CHECK_LT(worldID, EmbedderWorldIdLimit);
727 727
728 HeapVector<ScriptSourceCode> sources = createSourcesVector(sourcesIn, numSou rces); 728 HeapVector<ScriptSourceCode> sources = createSourcesVector(sourcesIn, numSou rces);
729 v8::HandleScope handleScope(toIsolate(frame())); 729 v8::HandleScope handleScope(toIsolate(frame()));
730 frame()->script().executeScriptInIsolatedWorld(worldID, sources, extensionGr oup, 0); 730 frame()->script().executeScriptInIsolatedWorld(worldID, sources, extensionGr oup, 0);
731 } 731 }
732 732
733 void WebLocalFrameImpl::setIsolatedWorldSecurityOrigin(int worldID, const WebSec urityOrigin& securityOrigin) 733 void WebLocalFrameImpl::setIsolatedWorldSecurityOrigin(int worldID, const WebSec urityOrigin& securityOrigin)
734 { 734 {
735 ASSERT(frame()); 735 DCHECK(frame());
736 DOMWrapperWorld::setIsolatedWorldSecurityOrigin(worldID, securityOrigin.get( )); 736 DOMWrapperWorld::setIsolatedWorldSecurityOrigin(worldID, securityOrigin.get( ));
737 } 737 }
738 738
739 void WebLocalFrameImpl::setIsolatedWorldContentSecurityPolicy(int worldID, const WebString& policy) 739 void WebLocalFrameImpl::setIsolatedWorldContentSecurityPolicy(int worldID, const WebString& policy)
740 { 740 {
741 ASSERT(frame()); 741 DCHECK(frame());
742 DOMWrapperWorld::setIsolatedWorldContentSecurityPolicy(worldID, policy); 742 DOMWrapperWorld::setIsolatedWorldContentSecurityPolicy(worldID, policy);
743 } 743 }
744 744
745 void WebLocalFrameImpl::setIsolatedWorldHumanReadableName(int worldID, const Web String& humanReadableName) 745 void WebLocalFrameImpl::setIsolatedWorldHumanReadableName(int worldID, const Web String& humanReadableName)
746 { 746 {
747 ASSERT(frame()); 747 DCHECK(frame());
748 DOMWrapperWorld::setIsolatedWorldHumanReadableName(worldID, humanReadableNam e); 748 DOMWrapperWorld::setIsolatedWorldHumanReadableName(worldID, humanReadableNam e);
749 } 749 }
750 750
751 void WebLocalFrameImpl::addMessageToConsole(const WebConsoleMessage& message) 751 void WebLocalFrameImpl::addMessageToConsole(const WebConsoleMessage& message)
752 { 752 {
753 ASSERT(frame()); 753 DCHECK(frame());
754 754
755 MessageLevel webCoreMessageLevel; 755 MessageLevel webCoreMessageLevel;
756 switch (message.level) { 756 switch (message.level) {
757 case WebConsoleMessage::LevelDebug: 757 case WebConsoleMessage::LevelDebug:
758 webCoreMessageLevel = DebugMessageLevel; 758 webCoreMessageLevel = DebugMessageLevel;
759 break; 759 break;
760 case WebConsoleMessage::LevelLog: 760 case WebConsoleMessage::LevelLog:
761 webCoreMessageLevel = LogMessageLevel; 761 webCoreMessageLevel = LogMessageLevel;
762 break; 762 break;
763 case WebConsoleMessage::LevelWarning: 763 case WebConsoleMessage::LevelWarning:
(...skipping 14 matching lines...) Expand all
778 { 778 {
779 if (!frame()) 779 if (!frame())
780 return; 780 return;
781 if (!frame()->settings()->scriptEnabled()) 781 if (!frame()->settings()->scriptEnabled())
782 return; 782 return;
783 V8GCController::collectGarbage(v8::Isolate::GetCurrent()); 783 V8GCController::collectGarbage(v8::Isolate::GetCurrent());
784 } 784 }
785 785
786 v8::Local<v8::Value> WebLocalFrameImpl::executeScriptAndReturnValue(const WebScr iptSource& source) 786 v8::Local<v8::Value> WebLocalFrameImpl::executeScriptAndReturnValue(const WebScr iptSource& source)
787 { 787 {
788 ASSERT(frame()); 788 DCHECK(frame());
789 789
790 TextPosition position(OrdinalNumber::fromOneBasedInt(source.startLine), Ordi nalNumber::first()); 790 TextPosition position(OrdinalNumber::fromOneBasedInt(source.startLine), Ordi nalNumber::first());
791 return frame()->script().executeScriptInMainWorldAndReturnValue(ScriptSource Code(source.code, source.url, position)); 791 return frame()->script().executeScriptInMainWorldAndReturnValue(ScriptSource Code(source.code, source.url, position));
792 } 792 }
793 793
794 void WebLocalFrameImpl::requestExecuteScriptAndReturnValue(const WebScriptSource & source, bool userGesture, WebScriptExecutionCallback* callback) 794 void WebLocalFrameImpl::requestExecuteScriptAndReturnValue(const WebScriptSource & source, bool userGesture, WebScriptExecutionCallback* callback)
795 { 795 {
796 ASSERT(frame()); 796 DCHECK(frame());
797 797
798 SuspendableScriptExecutor::createAndRun(frame(), 0, createSourcesVector(&sou rce, 1), 0, userGesture, callback); 798 SuspendableScriptExecutor::createAndRun(frame(), 0, createSourcesVector(&sou rce, 1), 0, userGesture, callback);
799 } 799 }
800 800
801 void WebLocalFrameImpl::executeScriptInIsolatedWorld(int worldID, const WebScrip tSource* sourcesIn, unsigned numSources, int extensionGroup, WebVector<v8::Local <v8::Value>>* results) 801 void WebLocalFrameImpl::executeScriptInIsolatedWorld(int worldID, const WebScrip tSource* sourcesIn, unsigned numSources, int extensionGroup, WebVector<v8::Local <v8::Value>>* results)
802 { 802 {
803 ASSERT(frame()); 803 DCHECK(frame());
804 RELEASE_ASSERT(worldID > 0); 804 CHECK_GT(worldID, 0);
805 RELEASE_ASSERT(worldID < EmbedderWorldIdLimit); 805 CHECK_LT(worldID, EmbedderWorldIdLimit);
806 806
807 HeapVector<ScriptSourceCode> sources = createSourcesVector(sourcesIn, numSou rces); 807 HeapVector<ScriptSourceCode> sources = createSourcesVector(sourcesIn, numSou rces);
808 808
809 if (results) { 809 if (results) {
810 Vector<v8::Local<v8::Value>> scriptResults; 810 Vector<v8::Local<v8::Value>> scriptResults;
811 frame()->script().executeScriptInIsolatedWorld(worldID, sources, extensi onGroup, &scriptResults); 811 frame()->script().executeScriptInIsolatedWorld(worldID, sources, extensi onGroup, &scriptResults);
812 WebVector<v8::Local<v8::Value>> v8Results(scriptResults.size()); 812 WebVector<v8::Local<v8::Value>> v8Results(scriptResults.size());
813 for (unsigned i = 0; i < scriptResults.size(); i++) 813 for (unsigned i = 0; i < scriptResults.size(); i++)
814 v8Results[i] = v8::Local<v8::Value>::New(toIsolate(frame()), scriptR esults[i]); 814 v8Results[i] = v8::Local<v8::Value>::New(toIsolate(frame()), scriptR esults[i]);
815 results->swap(v8Results); 815 results->swap(v8Results);
816 } else { 816 } else {
817 v8::HandleScope handleScope(toIsolate(frame())); 817 v8::HandleScope handleScope(toIsolate(frame()));
818 frame()->script().executeScriptInIsolatedWorld(worldID, sources, extensi onGroup, 0); 818 frame()->script().executeScriptInIsolatedWorld(worldID, sources, extensi onGroup, 0);
819 } 819 }
820 } 820 }
821 821
822 void WebLocalFrameImpl::requestExecuteScriptInIsolatedWorld(int worldID, const W ebScriptSource* sourcesIn, unsigned numSources, int extensionGroup, bool userGes ture, WebScriptExecutionCallback* callback) 822 void WebLocalFrameImpl::requestExecuteScriptInIsolatedWorld(int worldID, const W ebScriptSource* sourcesIn, unsigned numSources, int extensionGroup, bool userGes ture, WebScriptExecutionCallback* callback)
823 { 823 {
824 ASSERT(frame()); 824 DCHECK(frame());
825 RELEASE_ASSERT(worldID > 0); 825 CHECK_GT(worldID, 0);
826 RELEASE_ASSERT(worldID < EmbedderWorldIdLimit); 826 CHECK_LT(worldID, EmbedderWorldIdLimit);
827 827
828 SuspendableScriptExecutor::createAndRun(frame(), worldID, createSourcesVecto r(sourcesIn, numSources), extensionGroup, userGesture, callback); 828 SuspendableScriptExecutor::createAndRun(frame(), worldID, createSourcesVecto r(sourcesIn, numSources), extensionGroup, userGesture, callback);
829 } 829 }
830 830
831 // TODO(bashi): Consider returning MaybeLocal. 831 // TODO(bashi): Consider returning MaybeLocal.
832 v8::Local<v8::Value> WebLocalFrameImpl::callFunctionEvenIfScriptDisabled(v8::Loc al<v8::Function> function, v8::Local<v8::Value> receiver, int argc, v8::Local<v8 ::Value> argv[]) 832 v8::Local<v8::Value> WebLocalFrameImpl::callFunctionEvenIfScriptDisabled(v8::Loc al<v8::Function> function, v8::Local<v8::Value> receiver, int argc, v8::Local<v8 ::Value> argv[])
833 { 833 {
834 ASSERT(frame()); 834 DCHECK(frame());
835 v8::Local<v8::Value> result; 835 v8::Local<v8::Value> result;
836 if (!frame()->script().callFunction(function, receiver, argc, static_cast<v8 ::Local<v8::Value>*>(argv)).ToLocal(&result)) 836 if (!frame()->script().callFunction(function, receiver, argc, static_cast<v8 ::Local<v8::Value>*>(argv)).ToLocal(&result))
837 return v8::Local<v8::Value>(); 837 return v8::Local<v8::Value>();
838 return result; 838 return result;
839 } 839 }
840 840
841 v8::Local<v8::Context> WebLocalFrameImpl::mainWorldScriptContext() const 841 v8::Local<v8::Context> WebLocalFrameImpl::mainWorldScriptContext() const
842 { 842 {
843 ScriptState* scriptState = ScriptState::forMainWorld(frame()); 843 ScriptState* scriptState = ScriptState::forMainWorld(frame());
844 ASSERT(scriptState); 844 DCHECK(scriptState);
845 return scriptState->context(); 845 return scriptState->context();
846 } 846 }
847 847
848 bool WebFrame::scriptCanAccess(WebFrame* target) 848 bool WebFrame::scriptCanAccess(WebFrame* target)
849 { 849 {
850 return BindingSecurity::shouldAllowAccessToFrame(mainThreadIsolate(), callin gDOMWindow(mainThreadIsolate()), target->toImplBase()->frame(), DoNotReportSecur ityError); 850 return BindingSecurity::shouldAllowAccessToFrame(mainThreadIsolate(), callin gDOMWindow(mainThreadIsolate()), target->toImplBase()->frame(), DoNotReportSecur ityError);
851 } 851 }
852 852
853 void WebLocalFrameImpl::reload(bool ignoreCache) 853 void WebLocalFrameImpl::reload(bool ignoreCache)
854 { 854 {
855 // TODO(clamy): Remove this function once RenderFrame calls load for all 855 // TODO(clamy): Remove this function once RenderFrame calls load for all
856 // requests. 856 // requests.
857 reloadWithOverrideURL(KURL(), ignoreCache); 857 reloadWithOverrideURL(KURL(), ignoreCache);
858 } 858 }
859 859
860 void WebLocalFrameImpl::reloadWithOverrideURL(const WebURL& overrideUrl, bool ig noreCache) 860 void WebLocalFrameImpl::reloadWithOverrideURL(const WebURL& overrideUrl, bool ig noreCache)
861 { 861 {
862 // TODO(clamy): Remove this function once RenderFrame calls load for all 862 // TODO(clamy): Remove this function once RenderFrame calls load for all
863 // requests. 863 // requests.
864 ASSERT(frame()); 864 DCHECK(frame());
865 WebFrameLoadType loadType = ignoreCache ? 865 WebFrameLoadType loadType = ignoreCache ?
866 WebFrameLoadType::ReloadBypassingCache : WebFrameLoadType::Reload; 866 WebFrameLoadType::ReloadBypassingCache : WebFrameLoadType::Reload;
867 WebURLRequest request = requestForReload(loadType, overrideUrl); 867 WebURLRequest request = requestForReload(loadType, overrideUrl);
868 if (request.isNull()) 868 if (request.isNull())
869 return; 869 return;
870 load(request, loadType, WebHistoryItem(), WebHistoryDifferentDocumentLoad, f alse); 870 load(request, loadType, WebHistoryItem(), WebHistoryDifferentDocumentLoad, f alse);
871 } 871 }
872 872
873 void WebLocalFrameImpl::reloadImage(const WebNode& webNode) 873 void WebLocalFrameImpl::reloadImage(const WebNode& webNode)
874 { 874 {
(...skipping 20 matching lines...) Expand all
895 WebURLRequest::CachePolicy cachePolicy) 895 WebURLRequest::CachePolicy cachePolicy)
896 { 896 {
897 // TODO(clamy): Remove this function once RenderFrame calls load for all 897 // TODO(clamy): Remove this function once RenderFrame calls load for all
898 // requests. 898 // requests.
899 WebURLRequest request = requestFromHistoryItem(item, cachePolicy); 899 WebURLRequest request = requestFromHistoryItem(item, cachePolicy);
900 load(request, WebFrameLoadType::BackForward, item, loadType, false); 900 load(request, WebFrameLoadType::BackForward, item, loadType, false);
901 } 901 }
902 902
903 void WebLocalFrameImpl::loadHTMLString(const WebData& data, const WebURL& baseUR L, const WebURL& unreachableURL, bool replace) 903 void WebLocalFrameImpl::loadHTMLString(const WebData& data, const WebURL& baseUR L, const WebURL& unreachableURL, bool replace)
904 { 904 {
905 ASSERT(frame()); 905 DCHECK(frame());
906 loadData(data, WebString::fromUTF8("text/html"), WebString::fromUTF8("UTF-8" ), baseURL, unreachableURL, replace, 906 loadData(data, WebString::fromUTF8("text/html"), WebString::fromUTF8("UTF-8" ), baseURL, unreachableURL, replace,
907 WebFrameLoadType::Standard, WebHistoryItem(), WebHistoryDifferentDocumen tLoad, false); 907 WebFrameLoadType::Standard, WebHistoryItem(), WebHistoryDifferentDocumen tLoad, false);
908 } 908 }
909 909
910 void WebLocalFrameImpl::stopLoading() 910 void WebLocalFrameImpl::stopLoading()
911 { 911 {
912 if (!frame()) 912 if (!frame())
913 return; 913 return;
914 // FIXME: Figure out what we should really do here. It seems like a bug 914 // FIXME: Figure out what we should really do here. It seems like a bug
915 // that FrameLoader::stopLoading doesn't call stopAllLoaders. 915 // that FrameLoader::stopLoading doesn't call stopAllLoaders.
916 frame()->loader().stopAllLoaders(); 916 frame()->loader().stopAllLoaders();
917 } 917 }
918 918
919 WebDataSource* WebLocalFrameImpl::provisionalDataSource() const 919 WebDataSource* WebLocalFrameImpl::provisionalDataSource() const
920 { 920 {
921 ASSERT(frame()); 921 DCHECK(frame());
922 return DataSourceForDocLoader(frame()->loader().provisionalDocumentLoader()) ; 922 return DataSourceForDocLoader(frame()->loader().provisionalDocumentLoader()) ;
923 } 923 }
924 924
925 WebDataSource* WebLocalFrameImpl::dataSource() const 925 WebDataSource* WebLocalFrameImpl::dataSource() const
926 { 926 {
927 ASSERT(frame()); 927 DCHECK(frame());
928 return DataSourceForDocLoader(frame()->loader().documentLoader()); 928 return DataSourceForDocLoader(frame()->loader().documentLoader());
929 } 929 }
930 930
931 void WebLocalFrameImpl::enableViewSourceMode(bool enable) 931 void WebLocalFrameImpl::enableViewSourceMode(bool enable)
932 { 932 {
933 if (frame()) 933 if (frame())
934 frame()->setInViewSourceMode(enable); 934 frame()->setInViewSourceMode(enable);
935 } 935 }
936 936
937 bool WebLocalFrameImpl::isViewSourceModeEnabled() const 937 bool WebLocalFrameImpl::isViewSourceModeEnabled() const
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 { 1020 {
1021 if (!frame()) 1021 if (!frame())
1022 return kNotFound; 1022 return kNotFound;
1023 1023
1024 IntPoint point = frame()->view()->viewportToContents(pointInViewport); 1024 IntPoint point = frame()->view()->viewportToContents(pointInViewport);
1025 HitTestResult result = frame()->eventHandler().hitTestResultAtPoint(point, H itTestRequest::ReadOnly | HitTestRequest::Active); 1025 HitTestResult result = frame()->eventHandler().hitTestResultAtPoint(point, H itTestRequest::ReadOnly | HitTestRequest::Active);
1026 const EphemeralRange range = frame()->rangeForPoint(result.roundedPointInInn erNodeFrame()); 1026 const EphemeralRange range = frame()->rangeForPoint(result.roundedPointInInn erNodeFrame());
1027 if (range.isNull()) 1027 if (range.isNull())
1028 return kNotFound; 1028 return kNotFound;
1029 Element* editable = frame()->selection().rootEditableElementOrDocumentElemen t(); 1029 Element* editable = frame()->selection().rootEditableElementOrDocumentElemen t();
1030 ASSERT(editable); 1030 DCHECK(editable);
1031 return PlainTextRange::create(*editable, range).start(); 1031 return PlainTextRange::create(*editable, range).start();
1032 } 1032 }
1033 1033
1034 bool WebLocalFrameImpl::executeCommand(const WebString& name, const WebNode& nod e) 1034 bool WebLocalFrameImpl::executeCommand(const WebString& name, const WebNode& nod e)
1035 { 1035 {
1036 ASSERT(frame()); 1036 DCHECK(frame());
1037 1037
1038 if (name.length() <= 2) 1038 if (name.length() <= 2)
1039 return false; 1039 return false;
1040 1040
1041 // Since we don't have NSControl, we will convert the format of command 1041 // Since we don't have NSControl, we will convert the format of command
1042 // string and call the function on Editor directly. 1042 // string and call the function on Editor directly.
1043 String command = name; 1043 String command = name;
1044 1044
1045 // Make sure the first letter is upper case. 1045 // Make sure the first letter is upper case.
1046 command.replace(0, 1, command.substring(0, 1).upper()); 1046 command.replace(0, 1, command.substring(0, 1).upper());
1047 1047
1048 // Remove the trailing ':' if existing. 1048 // Remove the trailing ':' if existing.
1049 if (command[command.length() - 1] == UChar(':')) 1049 if (command[command.length() - 1] == UChar(':'))
1050 command = command.substring(0, command.length() - 1); 1050 command = command.substring(0, command.length() - 1);
1051 1051
1052 WebPluginContainerImpl* pluginContainer = pluginContainerFromNode(frame(), n ode); 1052 WebPluginContainerImpl* pluginContainer = pluginContainerFromNode(frame(), n ode);
1053 if (pluginContainer && pluginContainer->executeEditCommand(name)) 1053 if (pluginContainer && pluginContainer->executeEditCommand(name))
1054 return true; 1054 return true;
1055 1055
1056 return frame()->editor().executeCommand(command); 1056 return frame()->editor().executeCommand(command);
1057 } 1057 }
1058 1058
1059 bool WebLocalFrameImpl::executeCommand(const WebString& name, const WebString& v alue, const WebNode& node) 1059 bool WebLocalFrameImpl::executeCommand(const WebString& name, const WebString& v alue, const WebNode& node)
1060 { 1060 {
1061 ASSERT(frame()); 1061 DCHECK(frame());
1062 1062
1063 WebPluginContainerImpl* pluginContainer = pluginContainerFromNode(frame(), n ode); 1063 WebPluginContainerImpl* pluginContainer = pluginContainerFromNode(frame(), n ode);
1064 if (pluginContainer && pluginContainer->executeEditCommand(name, value)) 1064 if (pluginContainer && pluginContainer->executeEditCommand(name, value))
1065 return true; 1065 return true;
1066 1066
1067 return frame()->editor().executeCommand(name, value); 1067 return frame()->editor().executeCommand(name, value);
1068 } 1068 }
1069 1069
1070 bool WebLocalFrameImpl::isCommandEnabled(const WebString& name) const 1070 bool WebLocalFrameImpl::isCommandEnabled(const WebString& name) const
1071 { 1071 {
1072 ASSERT(frame()); 1072 DCHECK(frame());
1073 return frame()->editor().createCommand(name).isEnabled(); 1073 return frame()->editor().createCommand(name).isEnabled();
1074 } 1074 }
1075 1075
1076 void WebLocalFrameImpl::enableContinuousSpellChecking(bool enable) 1076 void WebLocalFrameImpl::enableContinuousSpellChecking(bool enable)
1077 { 1077 {
1078 if (enable == isContinuousSpellCheckingEnabled()) 1078 if (enable == isContinuousSpellCheckingEnabled())
1079 return; 1079 return;
1080 frame()->spellChecker().toggleContinuousSpellChecking(); 1080 frame()->spellChecker().toggleContinuousSpellChecking();
1081 } 1081 }
1082 1082
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 WebPlugin* WebLocalFrameImpl::focusedPluginIfInputMethodSupported() 1245 WebPlugin* WebLocalFrameImpl::focusedPluginIfInputMethodSupported()
1246 { 1246 {
1247 WebPluginContainerImpl* container = WebLocalFrameImpl::pluginContainerFromNo de(frame(), WebNode(frame()->document()->focusedElement())); 1247 WebPluginContainerImpl* container = WebLocalFrameImpl::pluginContainerFromNo de(frame(), WebNode(frame()->document()->focusedElement()));
1248 if (container && container->supportsInputMethod()) 1248 if (container && container->supportsInputMethod())
1249 return container->plugin(); 1249 return container->plugin();
1250 return 0; 1250 return 0;
1251 } 1251 }
1252 1252
1253 int WebLocalFrameImpl::printBegin(const WebPrintParams& printParams, const WebNo de& constrainToNode) 1253 int WebLocalFrameImpl::printBegin(const WebPrintParams& printParams, const WebNo de& constrainToNode)
1254 { 1254 {
1255 ASSERT(!frame()->document()->isFrameSet()); 1255 DCHECK(!frame()->document()->isFrameSet());
1256 WebPluginContainerImpl* pluginContainer = nullptr; 1256 WebPluginContainerImpl* pluginContainer = nullptr;
1257 if (constrainToNode.isNull()) { 1257 if (constrainToNode.isNull()) {
1258 // If this is a plugin document, check if the plugin supports its own 1258 // If this is a plugin document, check if the plugin supports its own
1259 // printing. If it does, we will delegate all printing to that. 1259 // printing. If it does, we will delegate all printing to that.
1260 pluginContainer = pluginContainerFromFrame(frame()); 1260 pluginContainer = pluginContainerFromFrame(frame());
1261 } else { 1261 } else {
1262 // We only support printing plugin nodes for now. 1262 // We only support printing plugin nodes for now.
1263 pluginContainer = toWebPluginContainerImpl(constrainToNode.pluginContain er()); 1263 pluginContainer = toWebPluginContainerImpl(constrainToNode.pluginContain er());
1264 } 1264 }
1265 1265
1266 if (pluginContainer && pluginContainer->supportsPaginatedPrint()) 1266 if (pluginContainer && pluginContainer->supportsPaginatedPrint())
1267 m_printContext = new ChromePluginPrintContext(frame(), pluginContainer, printParams); 1267 m_printContext = new ChromePluginPrintContext(frame(), pluginContainer, printParams);
1268 else 1268 else
1269 m_printContext = new ChromePrintContext(frame()); 1269 m_printContext = new ChromePrintContext(frame());
1270 1270
1271 FloatRect rect(0, 0, static_cast<float>(printParams.printContentArea.width), static_cast<float>(printParams.printContentArea.height)); 1271 FloatRect rect(0, 0, static_cast<float>(printParams.printContentArea.width), static_cast<float>(printParams.printContentArea.height));
1272 m_printContext->begin(rect.width(), rect.height()); 1272 m_printContext->begin(rect.width(), rect.height());
1273 float pageHeight; 1273 float pageHeight;
1274 // We ignore the overlays calculation for now since they are generated in th e 1274 // We ignore the overlays calculation for now since they are generated in th e
1275 // browser. pageHeight is actually an output parameter. 1275 // browser. pageHeight is actually an output parameter.
1276 m_printContext->computePageRects(rect, 0, 0, 1.0, pageHeight); 1276 m_printContext->computePageRects(rect, 0, 0, 1.0, pageHeight);
1277 1277
1278 return static_cast<int>(m_printContext->pageCount()); 1278 return static_cast<int>(m_printContext->pageCount());
1279 } 1279 }
1280 1280
1281 float WebLocalFrameImpl::getPrintPageShrink(int page) 1281 float WebLocalFrameImpl::getPrintPageShrink(int page)
1282 { 1282 {
1283 ASSERT(m_printContext && page >= 0); 1283 DCHECK(m_printContext);
1284 DCHECK_GE(page, 0);
1284 return m_printContext->getPageShrink(page); 1285 return m_printContext->getPageShrink(page);
1285 } 1286 }
1286 1287
1287 float WebLocalFrameImpl::printPage(int page, WebCanvas* canvas) 1288 float WebLocalFrameImpl::printPage(int page, WebCanvas* canvas)
1288 { 1289 {
1289 #if ENABLE(PRINTING) 1290 #if ENABLE(PRINTING)
1290 1291 DCHECK(m_printContext);
1291 ASSERT(m_printContext && page >= 0 && frame() && frame()->document()); 1292 DCHECK_GE(page, 0);
1293 DCHECK(frame());
1294 DCHECK(frame()->document());
1292 1295
1293 return m_printContext->spoolSinglePage(canvas, page); 1296 return m_printContext->spoolSinglePage(canvas, page);
1294 #else 1297 #else
1295 return 0; 1298 return 0;
1296 #endif 1299 #endif
1297 } 1300 }
1298 1301
1299 void WebLocalFrameImpl::printEnd() 1302 void WebLocalFrameImpl::printEnd()
1300 { 1303 {
1301 ASSERT(m_printContext); 1304 DCHECK(m_printContext);
1302 m_printContext->end(); 1305 m_printContext->end();
1303 m_printContext.clear(); 1306 m_printContext.clear();
1304 } 1307 }
1305 1308
1306 bool WebLocalFrameImpl::isPrintScalingDisabledForPlugin(const WebNode& node) 1309 bool WebLocalFrameImpl::isPrintScalingDisabledForPlugin(const WebNode& node)
1307 { 1310 {
1308 WebPluginContainerImpl* pluginContainer = node.isNull() ? pluginContainerFr omFrame(frame()) : toWebPluginContainerImpl(node.pluginContainer()); 1311 WebPluginContainerImpl* pluginContainer = node.isNull() ? pluginContainerFr omFrame(frame()) : toWebPluginContainerImpl(node.pluginContainer());
1309 1312
1310 if (!pluginContainer || !pluginContainer->supportsPaginatedPrint()) 1313 if (!pluginContainer || !pluginContainer->supportsPaginatedPrint())
1311 return false; 1314 return false;
(...skipping 23 matching lines...) Expand all
1335 1338
1336 void WebLocalFrameImpl::pageSizeAndMarginsInPixels(int pageIndex, WebSize& pageS ize, int& marginTop, int& marginRight, int& marginBottom, int& marginLeft) 1339 void WebLocalFrameImpl::pageSizeAndMarginsInPixels(int pageIndex, WebSize& pageS ize, int& marginTop, int& marginRight, int& marginBottom, int& marginLeft)
1337 { 1340 {
1338 IntSize size = pageSize; 1341 IntSize size = pageSize;
1339 frame()->document()->pageSizeAndMarginsInPixels(pageIndex, size, marginTop, marginRight, marginBottom, marginLeft); 1342 frame()->document()->pageSizeAndMarginsInPixels(pageIndex, size, marginTop, marginRight, marginBottom, marginLeft);
1340 pageSize = size; 1343 pageSize = size;
1341 } 1344 }
1342 1345
1343 WebString WebLocalFrameImpl::pageProperty(const WebString& propertyName, int pag eIndex) 1346 WebString WebLocalFrameImpl::pageProperty(const WebString& propertyName, int pag eIndex)
1344 { 1347 {
1345 ASSERT(m_printContext); 1348 DCHECK(m_printContext);
1346 return m_printContext->pageProperty(frame(), propertyName.utf8().data(), pag eIndex); 1349 return m_printContext->pageProperty(frame(), propertyName.utf8().data(), pag eIndex);
1347 } 1350 }
1348 1351
1349 void WebLocalFrameImpl::registerTestInterface(const WebString& name, WebTestInte rfaceFactory* factory) 1352 void WebLocalFrameImpl::registerTestInterface(const WebString& name, WebTestInte rfaceFactory* factory)
1350 { 1353 {
1351 m_testInterfaces.set(name, adoptPtr(factory)); 1354 m_testInterfaces.set(name, adoptPtr(factory));
1352 } 1355 }
1353 1356
1354 v8::Local<v8::Value> WebLocalFrameImpl::createTestInterface(const AtomicString& name) 1357 v8::Local<v8::Value> WebLocalFrameImpl::createTestInterface(const AtomicString& name)
1355 { 1358 {
1356 if (WebTestInterfaceFactory* factory = m_testInterfaces.get(name)) { 1359 if (WebTestInterfaceFactory* factory = m_testInterfaces.get(name)) {
1357 ScriptState* scriptState = ScriptState::forMainWorld(frame()); 1360 ScriptState* scriptState = ScriptState::forMainWorld(frame());
1358 ASSERT(scriptState->contextIsValid()); 1361 DCHECK(scriptState->contextIsValid());
1359 v8::EscapableHandleScope handleScope(scriptState->isolate()); 1362 v8::EscapableHandleScope handleScope(scriptState->isolate());
1360 ScriptState::Scope scope(scriptState); 1363 ScriptState::Scope scope(scriptState);
1361 return handleScope.Escape(factory->createInstance(scriptState->context() )); 1364 return handleScope.Escape(factory->createInstance(scriptState->context() ));
1362 } 1365 }
1363 return v8::Local<v8::Value>(); 1366 return v8::Local<v8::Value>();
1364 } 1367 }
1365 1368
1366 void WebLocalFrameImpl::printPagesWithBoundaries(WebCanvas* canvas, const WebSiz e& pageSizeInPixels) 1369 void WebLocalFrameImpl::printPagesWithBoundaries(WebCanvas* canvas, const WebSiz e& pageSizeInPixels)
1367 { 1370 {
1368 ASSERT(m_printContext); 1371 DCHECK(m_printContext);
1369 1372
1370 m_printContext->spoolAllPagesWithBoundaries(canvas, FloatSize(pageSizeInPixe ls.width, pageSizeInPixels.height)); 1373 m_printContext->spoolAllPagesWithBoundaries(canvas, FloatSize(pageSizeInPixe ls.width, pageSizeInPixels.height));
1371 } 1374 }
1372 1375
1373 WebRect WebLocalFrameImpl::selectionBoundsRect() const 1376 WebRect WebLocalFrameImpl::selectionBoundsRect() const
1374 { 1377 {
1375 return hasSelection() ? WebRect(IntRect(frame()->selection().bounds())) : We bRect(); 1378 return hasSelection() ? WebRect(IntRect(frame()->selection().bounds())) : We bRect();
1376 } 1379 }
1377 1380
1378 bool WebLocalFrameImpl::selectionStartHasSpellingMarkerFor(int from, int length) const 1381 bool WebLocalFrameImpl::selectionStartHasSpellingMarkerFor(int from, int length) const
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 } 1475 }
1473 1476
1474 WebLocalFrameImpl::WebLocalFrameImpl(WebRemoteFrame* oldWebFrame, WebFrameClient * client) 1477 WebLocalFrameImpl::WebLocalFrameImpl(WebRemoteFrame* oldWebFrame, WebFrameClient * client)
1475 : WebLocalFrameImpl(oldWebFrame->inShadowTree() ? WebTreeScopeType::Shadow : WebTreeScopeType::Document, client) 1478 : WebLocalFrameImpl(oldWebFrame->inShadowTree() ? WebTreeScopeType::Shadow : WebTreeScopeType::Document, client)
1476 { 1479 {
1477 } 1480 }
1478 1481
1479 WebLocalFrameImpl::~WebLocalFrameImpl() 1482 WebLocalFrameImpl::~WebLocalFrameImpl()
1480 { 1483 {
1481 // The widget for the frame, if any, must have already been closed. 1484 // The widget for the frame, if any, must have already been closed.
1482 ASSERT(!m_frameWidget); 1485 DCHECK(!m_frameWidget);
1483 frameCount--; 1486 frameCount--;
1484 1487
1485 #if !ENABLE(OILPAN) 1488 #if !ENABLE(OILPAN)
1486 cancelPendingScopingEffort(); 1489 cancelPendingScopingEffort();
1487 #endif 1490 #endif
1488 } 1491 }
1489 1492
1490 #if ENABLE(OILPAN) 1493 #if ENABLE(OILPAN)
1491 DEFINE_TRACE(WebLocalFrameImpl) 1494 DEFINE_TRACE(WebLocalFrameImpl)
1492 { 1495 {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1554 frame()->tree().setPrecalculatedName(name, uniqueName); 1557 frame()->tree().setPrecalculatedName(name, uniqueName);
1555 // We must call init() after m_frame is assigned because it is referenced 1558 // We must call init() after m_frame is assigned because it is referenced
1556 // during init(). Note that this may dispatch JS events; the frame may be 1559 // during init(). Note that this may dispatch JS events; the frame may be
1557 // detached after init() returns. 1560 // detached after init() returns.
1558 frame()->init(); 1561 frame()->init();
1559 } 1562 }
1560 1563
1561 RawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const FrameLoadRequest& r equest, 1564 RawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const FrameLoadRequest& r equest,
1562 const AtomicString& name, HTMLFrameOwnerElement* ownerElement) 1565 const AtomicString& name, HTMLFrameOwnerElement* ownerElement)
1563 { 1566 {
1564 ASSERT(m_client); 1567 DCHECK(m_client);
1565 TRACE_EVENT0("blink", "WebLocalFrameImpl::createChildframe"); 1568 TRACE_EVENT0("blink", "WebLocalFrameImpl::createChildframe");
1566 WebTreeScopeType scope = frame()->document() == ownerElement->treeScope() 1569 WebTreeScopeType scope = frame()->document() == ownerElement->treeScope()
1567 ? WebTreeScopeType::Document 1570 ? WebTreeScopeType::Document
1568 : WebTreeScopeType::Shadow; 1571 : WebTreeScopeType::Shadow;
1569 WebFrameOwnerProperties ownerProperties(ownerElement->scrollingMode(), owner Element->marginWidth(), ownerElement->marginHeight()); 1572 WebFrameOwnerProperties ownerProperties(ownerElement->scrollingMode(), owner Element->marginWidth(), ownerElement->marginHeight());
1570 // FIXME: Using subResourceAttributeName as fallback is not a perfect 1573 // FIXME: Using subResourceAttributeName as fallback is not a perfect
1571 // solution. subResourceAttributeName returns just one attribute name. The 1574 // solution. subResourceAttributeName returns just one attribute name. The
1572 // element might not have the attribute, and there might be other attributes 1575 // element might not have the attribute, and there might be other attributes
1573 // which can identify the element. 1576 // which can identify the element.
1574 AtomicString uniqueName = frame()->tree().calculateUniqueNameForNewChildFram e( 1577 AtomicString uniqueName = frame()->tree().calculateUniqueNameForNewChildFram e(
(...skipping 28 matching lines...) Expand all
1603 // detached by script in the page. 1606 // detached by script in the page.
1604 if (!webframeChild->parent()) 1607 if (!webframeChild->parent())
1605 return nullptr; 1608 return nullptr;
1606 return webframeChild->frame(); 1609 return webframeChild->frame();
1607 } 1610 }
1608 1611
1609 void WebLocalFrameImpl::didChangeContentsSize(const IntSize& size) 1612 void WebLocalFrameImpl::didChangeContentsSize(const IntSize& size)
1610 { 1613 {
1611 // This is only possible on the main frame. 1614 // This is only possible on the main frame.
1612 if (m_textFinder && m_textFinder->totalMatchCount() > 0) { 1615 if (m_textFinder && m_textFinder->totalMatchCount() > 0) {
1613 ASSERT(!parent()); 1616 DCHECK(!parent());
1614 m_textFinder->increaseMarkerVersion(); 1617 m_textFinder->increaseMarkerVersion();
1615 } 1618 }
1616 } 1619 }
1617 1620
1618 void WebLocalFrameImpl::createFrameView() 1621 void WebLocalFrameImpl::createFrameView()
1619 { 1622 {
1620 TRACE_EVENT0("blink", "WebLocalFrameImpl::createFrameView"); 1623 TRACE_EVENT0("blink", "WebLocalFrameImpl::createFrameView");
1621 1624
1622 ASSERT(frame()); // If frame() doesn't exist, we probably didn't init proper ly. 1625 DCHECK(frame()); // If frame() doesn't exist, we probably didn't init proper ly.
1623 1626
1624 WebViewImpl* webView = viewImpl(); 1627 WebViewImpl* webView = viewImpl();
1625 1628
1626 bool isMainFrame = !parent(); 1629 bool isMainFrame = !parent();
1627 IntSize initialSize = (isMainFrame || !frameWidget()) ? webView->mainFrameSi ze() : (IntSize)frameWidget()->size(); 1630 IntSize initialSize = (isMainFrame || !frameWidget()) ? webView->mainFrameSi ze() : (IntSize)frameWidget()->size();
1628 bool isTransparent = !isMainFrame && parent()->isWebRemoteFrame() ? true : w ebView->isTransparent(); 1631 bool isTransparent = !isMainFrame && parent()->isWebRemoteFrame() ? true : w ebView->isTransparent();
1629 1632
1630 frame()->createView(initialSize, webView->baseBackgroundColor(), isTranspare nt); 1633 frame()->createView(initialSize, webView->baseBackgroundColor(), isTranspare nt);
1631 if (webView->shouldAutoResize() && frame()->isLocalRoot()) 1634 if (webView->shouldAutoResize() && frame()->isLocalRoot())
1632 frame()->view()->enableAutoSizeMode(webView->minAutoSize(), webView->max AutoSize()); 1635 frame()->view()->enableAutoSizeMode(webView->minAutoSize(), webView->max AutoSize());
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1830 m_autofillClient = autofillClient; 1833 m_autofillClient = autofillClient;
1831 } 1834 }
1832 1835
1833 WebAutofillClient* WebLocalFrameImpl::autofillClient() 1836 WebAutofillClient* WebLocalFrameImpl::autofillClient()
1834 { 1837 {
1835 return m_autofillClient; 1838 return m_autofillClient;
1836 } 1839 }
1837 1840
1838 void WebLocalFrameImpl::setDevToolsAgentClient(WebDevToolsAgentClient* devToolsC lient) 1841 void WebLocalFrameImpl::setDevToolsAgentClient(WebDevToolsAgentClient* devToolsC lient)
1839 { 1842 {
1840 ASSERT(devToolsClient); 1843 DCHECK(devToolsClient);
1841 m_devToolsAgent = WebDevToolsAgentImpl::create(this, devToolsClient); 1844 m_devToolsAgent = WebDevToolsAgentImpl::create(this, devToolsClient);
1842 } 1845 }
1843 1846
1844 WebDevToolsAgent* WebLocalFrameImpl::devToolsAgent() 1847 WebDevToolsAgent* WebLocalFrameImpl::devToolsAgent()
1845 { 1848 {
1846 return m_devToolsAgent.get(); 1849 return m_devToolsAgent.get();
1847 } 1850 }
1848 1851
1849 void WebLocalFrameImpl::setFrameOwnerProperties(const WebFrameOwnerProperties& f rameOwnerProperties) 1852 void WebLocalFrameImpl::setFrameOwnerProperties(const WebFrameOwnerProperties& f rameOwnerProperties)
1850 { 1853 {
1851 // At the moment, this is only used to replicate frame owner properties 1854 // At the moment, this is only used to replicate frame owner properties
1852 // for frames with a remote owner. 1855 // for frames with a remote owner.
1853 FrameOwner* owner = frame()->owner(); 1856 FrameOwner* owner = frame()->owner();
1854 ASSERT(owner); 1857 DCHECK(owner);
1855 toRemoteFrameOwner(owner)->setScrollingMode(frameOwnerProperties.scrollingMo de); 1858 toRemoteFrameOwner(owner)->setScrollingMode(frameOwnerProperties.scrollingMo de);
1856 toRemoteFrameOwner(owner)->setMarginWidth(frameOwnerProperties.marginWidth); 1859 toRemoteFrameOwner(owner)->setMarginWidth(frameOwnerProperties.marginWidth);
1857 toRemoteFrameOwner(owner)->setMarginHeight(frameOwnerProperties.marginHeight ); 1860 toRemoteFrameOwner(owner)->setMarginHeight(frameOwnerProperties.marginHeight );
1858 } 1861 }
1859 1862
1860 WebLocalFrameImpl* WebLocalFrameImpl::localRoot() 1863 WebLocalFrameImpl* WebLocalFrameImpl::localRoot()
1861 { 1864 {
1862 // This can't use the LocalFrame::localFrameRoot, since it may be called 1865 // This can't use the LocalFrame::localFrameRoot, since it may be called
1863 // when the WebLocalFrame exists but the core LocalFrame does not. 1866 // when the WebLocalFrame exists but the core LocalFrame does not.
1864 // TODO(alexmos, dcheng): Clean this up to only calculate this in one place. 1867 // TODO(alexmos, dcheng): Clean this up to only calculate this in one place.
(...skipping 14 matching lines...) Expand all
1879 WebLocalFrame* WebLocalFrameImpl::traverseNextLocal(bool wrap) const 1882 WebLocalFrame* WebLocalFrameImpl::traverseNextLocal(bool wrap) const
1880 { 1883 {
1881 WebFrame* nextLocalFrame = this->traverseNext(wrap); 1884 WebFrame* nextLocalFrame = this->traverseNext(wrap);
1882 while (nextLocalFrame && !nextLocalFrame->isWebLocalFrame()) 1885 while (nextLocalFrame && !nextLocalFrame->isWebLocalFrame())
1883 nextLocalFrame = nextLocalFrame->traverseNext(wrap); 1886 nextLocalFrame = nextLocalFrame->traverseNext(wrap);
1884 return nextLocalFrame ? nextLocalFrame->toWebLocalFrame() : nullptr; 1887 return nextLocalFrame ? nextLocalFrame->toWebLocalFrame() : nullptr;
1885 } 1888 }
1886 1889
1887 void WebLocalFrameImpl::sendPings(const WebNode& contextNode, const WebURL& dest inationURL) 1890 void WebLocalFrameImpl::sendPings(const WebNode& contextNode, const WebURL& dest inationURL)
1888 { 1891 {
1889 ASSERT(frame()); 1892 DCHECK(frame());
1890 Element* anchor = contextNode.constUnwrap<Node>()->enclosingLinkEventParentO rSelf(); 1893 Element* anchor = contextNode.constUnwrap<Node>()->enclosingLinkEventParentO rSelf();
1891 if (isHTMLAnchorElement(anchor)) 1894 if (isHTMLAnchorElement(anchor))
1892 toHTMLAnchorElement(anchor)->sendPings(destinationURL); 1895 toHTMLAnchorElement(anchor)->sendPings(destinationURL);
1893 } 1896 }
1894 1897
1895 WebURLRequest WebLocalFrameImpl::requestFromHistoryItem(const WebHistoryItem& it em, 1898 WebURLRequest WebLocalFrameImpl::requestFromHistoryItem(const WebHistoryItem& it em,
1896 WebURLRequest::CachePolicy cachePolicy) const 1899 WebURLRequest::CachePolicy cachePolicy) const
1897 { 1900 {
1898 RawPtr<HistoryItem> historyItem = RawPtr<HistoryItem>(item); 1901 RawPtr<HistoryItem> historyItem = RawPtr<HistoryItem>(item);
1899 ResourceRequest request = FrameLoader::resourceRequestFromHistoryItem( 1902 ResourceRequest request = FrameLoader::resourceRequestFromHistoryItem(
1900 historyItem.get(), static_cast<ResourceRequestCachePolicy>(cachePolicy)) ; 1903 historyItem.get(), static_cast<ResourceRequestCachePolicy>(cachePolicy)) ;
1901 return WrappedResourceRequest(request); 1904 return WrappedResourceRequest(request);
1902 } 1905 }
1903 1906
1904 WebURLRequest WebLocalFrameImpl::requestForReload(WebFrameLoadType loadType, 1907 WebURLRequest WebLocalFrameImpl::requestForReload(WebFrameLoadType loadType,
1905 const WebURL& overrideUrl) const 1908 const WebURL& overrideUrl) const
1906 { 1909 {
1907 ASSERT(frame()); 1910 DCHECK(frame());
1908 ResourceRequest request = frame()->loader().resourceRequestForReload( 1911 ResourceRequest request = frame()->loader().resourceRequestForReload(
1909 static_cast<FrameLoadType>(loadType), overrideUrl); 1912 static_cast<FrameLoadType>(loadType), overrideUrl);
1910 return WrappedResourceRequest(request); 1913 return WrappedResourceRequest(request);
1911 } 1914 }
1912 1915
1913 void WebLocalFrameImpl::load(const WebURLRequest& request, WebFrameLoadType webF rameLoadType, 1916 void WebLocalFrameImpl::load(const WebURLRequest& request, WebFrameLoadType webF rameLoadType,
1914 const WebHistoryItem& item, WebHistoryLoadType webHistoryLoadType, bool isCl ientRedirect) 1917 const WebHistoryItem& item, WebHistoryLoadType webHistoryLoadType, bool isCl ientRedirect)
1915 { 1918 {
1916 ASSERT(frame()); 1919 DCHECK(frame());
1917 ASSERT(!request.isNull()); 1920 DCHECK(!request.isNull());
1918 const ResourceRequest& resourceRequest = request.toResourceRequest(); 1921 const ResourceRequest& resourceRequest = request.toResourceRequest();
1919 1922
1920 if (resourceRequest.url().protocolIs("javascript") 1923 if (resourceRequest.url().protocolIs("javascript")
1921 && webFrameLoadType == WebFrameLoadType::Standard) { 1924 && webFrameLoadType == WebFrameLoadType::Standard) {
1922 loadJavaScriptURL(resourceRequest.url()); 1925 loadJavaScriptURL(resourceRequest.url());
1923 return; 1926 return;
1924 } 1927 }
1925 1928
1926 FrameLoadRequest frameRequest = FrameLoadRequest(nullptr, resourceRequest); 1929 FrameLoadRequest frameRequest = FrameLoadRequest(nullptr, resourceRequest);
1927 if (isClientRedirect) 1930 if (isClientRedirect)
1928 frameRequest.setClientRedirect(ClientRedirect); 1931 frameRequest.setClientRedirect(ClientRedirect);
1929 RawPtr<HistoryItem> historyItem = RawPtr<HistoryItem>(item); 1932 RawPtr<HistoryItem> historyItem = RawPtr<HistoryItem>(item);
1930 frame()->loader().load( 1933 frame()->loader().load(
1931 frameRequest, static_cast<FrameLoadType>(webFrameLoadType), historyItem. get(), 1934 frameRequest, static_cast<FrameLoadType>(webFrameLoadType), historyItem. get(),
1932 static_cast<HistoryLoadType>(webHistoryLoadType)); 1935 static_cast<HistoryLoadType>(webHistoryLoadType));
1933 } 1936 }
1934 1937
1935 void WebLocalFrameImpl::loadData(const WebData& data, const WebString& mimeType, 1938 void WebLocalFrameImpl::loadData(const WebData& data, const WebString& mimeType,
1936 const WebString& textEncoding, const WebURL& baseURL, const WebURL& unreacha bleURL, bool replace, 1939 const WebString& textEncoding, const WebURL& baseURL, const WebURL& unreacha bleURL, bool replace,
1937 WebFrameLoadType webFrameLoadType, const WebHistoryItem& item, 1940 WebFrameLoadType webFrameLoadType, const WebHistoryItem& item,
1938 WebHistoryLoadType webHistoryLoadType, bool isClientRedirect) 1941 WebHistoryLoadType webHistoryLoadType, bool isClientRedirect)
1939 { 1942 {
1940 ASSERT(frame()); 1943 DCHECK(frame());
1941 1944
1942 // If we are loading substitute data to replace an existing load, then 1945 // If we are loading substitute data to replace an existing load, then
1943 // inherit all of the properties of that original request. This way, 1946 // inherit all of the properties of that original request. This way,
1944 // reload will re-attempt the original request. It is essential that 1947 // reload will re-attempt the original request. It is essential that
1945 // we only do this when there is an unreachableURL since a non-empty 1948 // we only do this when there is an unreachableURL since a non-empty
1946 // unreachableURL informs FrameLoader::reload to load unreachableURL 1949 // unreachableURL informs FrameLoader::reload to load unreachableURL
1947 // instead of the currently loaded URL. 1950 // instead of the currently loaded URL.
1948 ResourceRequest request; 1951 ResourceRequest request;
1949 if (replace && !unreachableURL.isEmpty() && frame()->loader().provisionalDoc umentLoader()) 1952 if (replace && !unreachableURL.isEmpty() && frame()->loader().provisionalDoc umentLoader())
1950 request = frame()->loader().provisionalDocumentLoader()->originalRequest (); 1953 request = frame()->loader().provisionalDocumentLoader()->originalRequest ();
1951 request.setURL(baseURL); 1954 request.setURL(baseURL);
1952 request.setCheckForBrowserSideNavigation(false); 1955 request.setCheckForBrowserSideNavigation(false);
1953 1956
1954 FrameLoadRequest frameRequest(0, request, SubstituteData(data, mimeType, tex tEncoding, unreachableURL)); 1957 FrameLoadRequest frameRequest(0, request, SubstituteData(data, mimeType, tex tEncoding, unreachableURL));
1955 ASSERT(frameRequest.substituteData().isValid()); 1958 DCHECK(frameRequest.substituteData().isValid());
1956 frameRequest.setReplacesCurrentItem(replace); 1959 frameRequest.setReplacesCurrentItem(replace);
1957 if (isClientRedirect) 1960 if (isClientRedirect)
1958 frameRequest.setClientRedirect(ClientRedirect); 1961 frameRequest.setClientRedirect(ClientRedirect);
1959 1962
1960 RawPtr<HistoryItem> historyItem = RawPtr<HistoryItem>(item); 1963 RawPtr<HistoryItem> historyItem = RawPtr<HistoryItem>(item);
1961 frame()->loader().load( 1964 frame()->loader().load(
1962 frameRequest, static_cast<FrameLoadType>(webFrameLoadType), historyItem. get(), 1965 frameRequest, static_cast<FrameLoadType>(webFrameLoadType), historyItem. get(),
1963 static_cast<HistoryLoadType>(webHistoryLoadType)); 1966 static_cast<HistoryLoadType>(webHistoryLoadType));
1964 } 1967 }
1965 1968
(...skipping 11 matching lines...) Expand all
1977 return frame()->document()->fetcher()->requestCount(); 1980 return frame()->document()->fetcher()->requestCount();
1978 } 1981 }
1979 1982
1980 bool WebLocalFrameImpl::isNavigationScheduledWithin(double intervalInSeconds) co nst 1983 bool WebLocalFrameImpl::isNavigationScheduledWithin(double intervalInSeconds) co nst
1981 { 1984 {
1982 return frame() && frame()->navigationScheduler().isNavigationScheduledWithin (intervalInSeconds); 1985 return frame() && frame()->navigationScheduler().isNavigationScheduledWithin (intervalInSeconds);
1983 } 1986 }
1984 1987
1985 void WebLocalFrameImpl::setCommittedFirstRealLoad() 1988 void WebLocalFrameImpl::setCommittedFirstRealLoad()
1986 { 1989 {
1987 ASSERT(frame()); 1990 DCHECK(frame());
1988 ensureFrameLoaderHasCommitted(frame()->loader()); 1991 ensureFrameLoaderHasCommitted(frame()->loader());
1989 } 1992 }
1990 1993
1991 void WebLocalFrameImpl::sendOrientationChangeEvent() 1994 void WebLocalFrameImpl::sendOrientationChangeEvent()
1992 { 1995 {
1993 if (!frame()) 1996 if (!frame())
1994 return; 1997 return;
1995 1998
1996 // Screen Orientation API 1999 // Screen Orientation API
1997 if (ScreenOrientationController::from(*frame())) 2000 if (ScreenOrientationController::from(*frame()))
1998 ScreenOrientationController::from(*frame())->notifyOrientationChanged(); 2001 ScreenOrientationController::from(*frame())->notifyOrientationChanged();
1999 2002
2000 // Legacy window.orientation API 2003 // Legacy window.orientation API
2001 if (RuntimeEnabledFeatures::orientationEventEnabled() && frame()->domWindow( )) 2004 if (RuntimeEnabledFeatures::orientationEventEnabled() && frame()->domWindow( ))
2002 frame()->localDOMWindow()->sendOrientationChangeEvent(); 2005 frame()->localDOMWindow()->sendOrientationChangeEvent();
2003 } 2006 }
2004 2007
2005 void WebLocalFrameImpl::willShowInstallBannerPrompt(int requestId, const WebVect or<WebString>& platforms, WebAppBannerPromptReply* reply) 2008 void WebLocalFrameImpl::willShowInstallBannerPrompt(int requestId, const WebVect or<WebString>& platforms, WebAppBannerPromptReply* reply)
2006 { 2009 {
2007 if (!RuntimeEnabledFeatures::appBannerEnabled() || !frame()) 2010 if (!RuntimeEnabledFeatures::appBannerEnabled() || !frame())
2008 return; 2011 return;
2009 2012
2010 AppBannerController::willShowInstallBannerPrompt(requestId, client()->appBan nerClient(), frame(), platforms, reply); 2013 AppBannerController::willShowInstallBannerPrompt(requestId, client()->appBan nerClient(), frame(), platforms, reply);
2011 } 2014 }
2012 2015
2013 void WebLocalFrameImpl::requestRunTask(WebSuspendableTask* task) const 2016 void WebLocalFrameImpl::requestRunTask(WebSuspendableTask* task) const
2014 { 2017 {
2015 ASSERT(frame()); 2018 DCHECK(frame());
2016 ASSERT(frame()->document()); 2019 DCHECK(frame()->document());
2017 frame()->document()->postSuspendableTask(WebSuspendableTaskWrapper::create(a doptPtr(task))); 2020 frame()->document()->postSuspendableTask(WebSuspendableTaskWrapper::create(a doptPtr(task)));
2018 } 2021 }
2019 2022
2020 void WebLocalFrameImpl::didCallAddSearchProvider() 2023 void WebLocalFrameImpl::didCallAddSearchProvider()
2021 { 2024 {
2022 UseCounter::count(frame(), UseCounter::ExternalAddSearchProvider); 2025 UseCounter::count(frame(), UseCounter::ExternalAddSearchProvider);
2023 } 2026 }
2024 2027
2025 void WebLocalFrameImpl::didCallIsSearchProviderInstalled() 2028 void WebLocalFrameImpl::didCallIsSearchProviderInstalled()
2026 { 2029 {
(...skipping 21 matching lines...) Expand all
2048 2051
2049 void WebLocalFrameImpl::cancelPendingScopingEffort() 2052 void WebLocalFrameImpl::cancelPendingScopingEffort()
2050 { 2053 {
2051 if (m_textFinder) 2054 if (m_textFinder)
2052 m_textFinder->cancelPendingScopingEffort(); 2055 m_textFinder->cancelPendingScopingEffort();
2053 } 2056 }
2054 2057
2055 void WebLocalFrameImpl::increaseMatchCount(int count, int identifier) 2058 void WebLocalFrameImpl::increaseMatchCount(int count, int identifier)
2056 { 2059 {
2057 // This function should only be called on the mainframe. 2060 // This function should only be called on the mainframe.
2058 ASSERT(!parent()); 2061 DCHECK(!parent());
2059 ensureTextFinder().increaseMatchCount(identifier, count); 2062 ensureTextFinder().increaseMatchCount(identifier, count);
2060 } 2063 }
2061 2064
2062 void WebLocalFrameImpl::resetMatchCount() 2065 void WebLocalFrameImpl::resetMatchCount()
2063 { 2066 {
2064 ensureTextFinder().resetMatchCount(); 2067 ensureTextFinder().resetMatchCount();
2065 } 2068 }
2066 2069
2067 void WebLocalFrameImpl::dispatchMessageEventWithOriginCheck(const WebSecurityOri gin& intendedTargetOrigin, const WebDOMEvent& event) 2070 void WebLocalFrameImpl::dispatchMessageEventWithOriginCheck(const WebSecurityOri gin& intendedTargetOrigin, const WebDOMEvent& event)
2068 { 2071 {
2069 ASSERT(!event.isNull()); 2072 DCHECK(!event.isNull());
2070 frame()->localDOMWindow()->dispatchMessageEventWithOriginCheck(intendedTarge tOrigin.get(), event, nullptr); 2073 frame()->localDOMWindow()->dispatchMessageEventWithOriginCheck(intendedTarge tOrigin.get(), event, nullptr);
2071 } 2074 }
2072 2075
2073 int WebLocalFrameImpl::findMatchMarkersVersion() const 2076 int WebLocalFrameImpl::findMatchMarkersVersion() const
2074 { 2077 {
2075 ASSERT(!parent()); 2078 DCHECK(!parent());
2076 2079
2077 if (m_textFinder) 2080 if (m_textFinder)
2078 return m_textFinder->findMatchMarkersVersion(); 2081 return m_textFinder->findMatchMarkersVersion();
2079 return 0; 2082 return 0;
2080 } 2083 }
2081 2084
2082 int WebLocalFrameImpl::selectNearestFindMatch(const WebFloatPoint& point, WebRec t* selectionRect) 2085 int WebLocalFrameImpl::selectNearestFindMatch(const WebFloatPoint& point, WebRec t* selectionRect)
2083 { 2086 {
2084 ASSERT(!parent()); 2087 DCHECK(!parent());
2085 return ensureTextFinder().selectNearestFindMatch(point, selectionRect); 2088 return ensureTextFinder().selectNearestFindMatch(point, selectionRect);
2086 } 2089 }
2087 2090
2088 WebFloatRect WebLocalFrameImpl::activeFindMatchRect() 2091 WebFloatRect WebLocalFrameImpl::activeFindMatchRect()
2089 { 2092 {
2090 ASSERT(!parent()); 2093 DCHECK(!parent());
2091 2094
2092 if (m_textFinder) 2095 if (m_textFinder)
2093 return m_textFinder->activeFindMatchRect(); 2096 return m_textFinder->activeFindMatchRect();
2094 return WebFloatRect(); 2097 return WebFloatRect();
2095 } 2098 }
2096 2099
2097 void WebLocalFrameImpl::findMatchRects(WebVector<WebFloatRect>& outputRects) 2100 void WebLocalFrameImpl::findMatchRects(WebVector<WebFloatRect>& outputRects)
2098 { 2101 {
2099 ASSERT(!parent()); 2102 DCHECK(!parent());
2100 ensureTextFinder().findMatchRects(outputRects); 2103 ensureTextFinder().findMatchRects(outputRects);
2101 } 2104 }
2102 2105
2103 void WebLocalFrameImpl::setTickmarks(const WebVector<WebRect>& tickmarks) 2106 void WebLocalFrameImpl::setTickmarks(const WebVector<WebRect>& tickmarks)
2104 { 2107 {
2105 if (frameView()) { 2108 if (frameView()) {
2106 Vector<IntRect> tickmarksConverted(tickmarks.size()); 2109 Vector<IntRect> tickmarksConverted(tickmarks.size());
2107 for (size_t i = 0; i < tickmarks.size(); ++i) 2110 for (size_t i = 0; i < tickmarks.size(); ++i)
2108 tickmarksConverted[i] = tickmarks[i]; 2111 tickmarksConverted[i] = tickmarks[i];
2109 frameView()->setTickmarks(tickmarksConverted); 2112 frameView()->setTickmarks(tickmarksConverted);
(...skipping 15 matching lines...) Expand all
2125 // There is a possibility that the frame being detached was the only 2128 // There is a possibility that the frame being detached was the only
2126 // pending one. We need to make sure final replies can be sent. 2129 // pending one. We need to make sure final replies can be sent.
2127 m_textFinder->flushCurrentScoping(); 2130 m_textFinder->flushCurrentScoping();
2128 2131
2129 m_textFinder->cancelPendingScopingEffort(); 2132 m_textFinder->cancelPendingScopingEffort();
2130 } 2133 }
2131 } 2134 }
2132 2135
2133 WebLocalFrameImpl* WebLocalFrameImpl::activeMatchFrame() const 2136 WebLocalFrameImpl* WebLocalFrameImpl::activeMatchFrame() const
2134 { 2137 {
2135 ASSERT(!parent()); 2138 DCHECK(!parent());
2136 2139
2137 if (m_textFinder) 2140 if (m_textFinder)
2138 return m_textFinder->activeMatchFrame(); 2141 return m_textFinder->activeMatchFrame();
2139 return 0; 2142 return 0;
2140 } 2143 }
2141 2144
2142 Range* WebLocalFrameImpl::activeMatch() const 2145 Range* WebLocalFrameImpl::activeMatch() const
2143 { 2146 {
2144 if (m_textFinder) 2147 if (m_textFinder)
2145 return m_textFinder->activeMatch(); 2148 return m_textFinder->activeMatch();
(...skipping 24 matching lines...) Expand all
2170 return WebSandboxFlags::None; 2173 return WebSandboxFlags::None;
2171 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags( )); 2174 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags( ));
2172 } 2175 }
2173 2176
2174 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags) 2177 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags)
2175 { 2178 {
2176 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); 2179 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags));
2177 } 2180 }
2178 2181
2179 } // namespace blink 2182 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebLeakDetector.cpp ('k') | third_party/WebKit/Source/web/WebMediaDevicesRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698