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

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: Fix compilation. 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 WillBeHeapVector<ScriptSourceCode> sources = createSourcesVector(sourcesIn, numSources); 728 WillBeHeapVector<ScriptSourceCode> sources = createSourcesVector(sourcesIn, numSources);
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 WillBeHeapVector<ScriptSourceCode> sources = createSourcesVector(sourcesIn, numSources); 807 WillBeHeapVector<ScriptSourceCode> sources = createSourcesVector(sourcesIn, numSources);
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::ReloadFromOrigin : WebFrameLoadType::Reload; 866 WebFrameLoadType::ReloadFromOrigin : 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 = adoptPtrWillBeNoop(new ChromePluginPrintContext(frame() , pluginContainer, printParams)); 1267 m_printContext = adoptPtrWillBeNoop(new ChromePluginPrintContext(frame() , pluginContainer, printParams));
1268 else 1268 else
1269 m_printContext = adoptPtrWillBeNoop(new ChromePrintContext(frame())); 1269 m_printContext = adoptPtrWillBeNoop(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 && page >= 0);
tkent 2016/03/31 23:05:21 Please split this into two. DCHECK(m_printCont
1284 return m_printContext->getPageShrink(page); 1284 return m_printContext->getPageShrink(page);
1285 } 1285 }
1286 1286
1287 float WebLocalFrameImpl::printPage(int page, WebCanvas* canvas) 1287 float WebLocalFrameImpl::printPage(int page, WebCanvas* canvas)
1288 { 1288 {
1289 #if ENABLE(PRINTING) 1289 #if ENABLE(PRINTING)
1290 1290
1291 ASSERT(m_printContext && page >= 0 && frame() && frame()->document()); 1291 DCHECK(m_printContext && page >= 0 && frame() && frame()->document());
tkent 2016/03/31 23:05:21 Please split this into four. DCHECK(m_printCon
1292 1292
1293 return m_printContext->spoolSinglePage(canvas, page); 1293 return m_printContext->spoolSinglePage(canvas, page);
1294 #else 1294 #else
1295 return 0; 1295 return 0;
1296 #endif 1296 #endif
1297 } 1297 }
1298 1298
1299 void WebLocalFrameImpl::printEnd() 1299 void WebLocalFrameImpl::printEnd()
1300 { 1300 {
1301 ASSERT(m_printContext); 1301 DCHECK(m_printContext);
1302 m_printContext->end(); 1302 m_printContext->end();
1303 m_printContext.clear(); 1303 m_printContext.clear();
1304 } 1304 }
1305 1305
1306 bool WebLocalFrameImpl::isPrintScalingDisabledForPlugin(const WebNode& node) 1306 bool WebLocalFrameImpl::isPrintScalingDisabledForPlugin(const WebNode& node)
1307 { 1307 {
1308 WebPluginContainerImpl* pluginContainer = node.isNull() ? pluginContainerFr omFrame(frame()) : toWebPluginContainerImpl(node.pluginContainer()); 1308 WebPluginContainerImpl* pluginContainer = node.isNull() ? pluginContainerFr omFrame(frame()) : toWebPluginContainerImpl(node.pluginContainer());
1309 1309
1310 if (!pluginContainer || !pluginContainer->supportsPaginatedPrint()) 1310 if (!pluginContainer || !pluginContainer->supportsPaginatedPrint())
1311 return false; 1311 return false;
(...skipping 23 matching lines...) Expand all
1335 1335
1336 void WebLocalFrameImpl::pageSizeAndMarginsInPixels(int pageIndex, WebSize& pageS ize, int& marginTop, int& marginRight, int& marginBottom, int& marginLeft) 1336 void WebLocalFrameImpl::pageSizeAndMarginsInPixels(int pageIndex, WebSize& pageS ize, int& marginTop, int& marginRight, int& marginBottom, int& marginLeft)
1337 { 1337 {
1338 IntSize size = pageSize; 1338 IntSize size = pageSize;
1339 frame()->document()->pageSizeAndMarginsInPixels(pageIndex, size, marginTop, marginRight, marginBottom, marginLeft); 1339 frame()->document()->pageSizeAndMarginsInPixels(pageIndex, size, marginTop, marginRight, marginBottom, marginLeft);
1340 pageSize = size; 1340 pageSize = size;
1341 } 1341 }
1342 1342
1343 WebString WebLocalFrameImpl::pageProperty(const WebString& propertyName, int pag eIndex) 1343 WebString WebLocalFrameImpl::pageProperty(const WebString& propertyName, int pag eIndex)
1344 { 1344 {
1345 ASSERT(m_printContext); 1345 DCHECK(m_printContext);
1346 return m_printContext->pageProperty(frame(), propertyName.utf8().data(), pag eIndex); 1346 return m_printContext->pageProperty(frame(), propertyName.utf8().data(), pag eIndex);
1347 } 1347 }
1348 1348
1349 void WebLocalFrameImpl::registerTestInterface(const WebString& name, WebTestInte rfaceFactory* factory) 1349 void WebLocalFrameImpl::registerTestInterface(const WebString& name, WebTestInte rfaceFactory* factory)
1350 { 1350 {
1351 m_testInterfaces.set(name, adoptPtr(factory)); 1351 m_testInterfaces.set(name, adoptPtr(factory));
1352 } 1352 }
1353 1353
1354 v8::Local<v8::Value> WebLocalFrameImpl::createTestInterface(const AtomicString& name) 1354 v8::Local<v8::Value> WebLocalFrameImpl::createTestInterface(const AtomicString& name)
1355 { 1355 {
1356 if (WebTestInterfaceFactory* factory = m_testInterfaces.get(name)) { 1356 if (WebTestInterfaceFactory* factory = m_testInterfaces.get(name)) {
1357 ScriptState* scriptState = ScriptState::forMainWorld(frame()); 1357 ScriptState* scriptState = ScriptState::forMainWorld(frame());
1358 ASSERT(scriptState->contextIsValid()); 1358 DCHECK(scriptState->contextIsValid());
1359 v8::EscapableHandleScope handleScope(scriptState->isolate()); 1359 v8::EscapableHandleScope handleScope(scriptState->isolate());
1360 ScriptState::Scope scope(scriptState); 1360 ScriptState::Scope scope(scriptState);
1361 return handleScope.Escape(factory->createInstance(scriptState->context() )); 1361 return handleScope.Escape(factory->createInstance(scriptState->context() ));
1362 } 1362 }
1363 return v8::Local<v8::Value>(); 1363 return v8::Local<v8::Value>();
1364 } 1364 }
1365 1365
1366 void WebLocalFrameImpl::printPagesWithBoundaries(WebCanvas* canvas, const WebSiz e& pageSizeInPixels) 1366 void WebLocalFrameImpl::printPagesWithBoundaries(WebCanvas* canvas, const WebSiz e& pageSizeInPixels)
1367 { 1367 {
1368 ASSERT(m_printContext); 1368 DCHECK(m_printContext);
1369 1369
1370 m_printContext->spoolAllPagesWithBoundaries(canvas, FloatSize(pageSizeInPixe ls.width, pageSizeInPixels.height)); 1370 m_printContext->spoolAllPagesWithBoundaries(canvas, FloatSize(pageSizeInPixe ls.width, pageSizeInPixels.height));
1371 } 1371 }
1372 1372
1373 WebRect WebLocalFrameImpl::selectionBoundsRect() const 1373 WebRect WebLocalFrameImpl::selectionBoundsRect() const
1374 { 1374 {
1375 return hasSelection() ? WebRect(IntRect(frame()->selection().bounds())) : We bRect(); 1375 return hasSelection() ? WebRect(IntRect(frame()->selection().bounds())) : We bRect();
1376 } 1376 }
1377 1377
1378 bool WebLocalFrameImpl::selectionStartHasSpellingMarkerFor(int from, int length) const 1378 bool WebLocalFrameImpl::selectionStartHasSpellingMarkerFor(int from, int length) const
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 } 1472 }
1473 1473
1474 WebLocalFrameImpl::WebLocalFrameImpl(WebRemoteFrame* oldWebFrame, WebFrameClient * client) 1474 WebLocalFrameImpl::WebLocalFrameImpl(WebRemoteFrame* oldWebFrame, WebFrameClient * client)
1475 : WebLocalFrameImpl(oldWebFrame->inShadowTree() ? WebTreeScopeType::Shadow : WebTreeScopeType::Document, client) 1475 : WebLocalFrameImpl(oldWebFrame->inShadowTree() ? WebTreeScopeType::Shadow : WebTreeScopeType::Document, client)
1476 { 1476 {
1477 } 1477 }
1478 1478
1479 WebLocalFrameImpl::~WebLocalFrameImpl() 1479 WebLocalFrameImpl::~WebLocalFrameImpl()
1480 { 1480 {
1481 // The widget for the frame, if any, must have already been closed. 1481 // The widget for the frame, if any, must have already been closed.
1482 ASSERT(!m_frameWidget); 1482 DCHECK(!m_frameWidget);
1483 frameCount--; 1483 frameCount--;
1484 1484
1485 #if !ENABLE(OILPAN) 1485 #if !ENABLE(OILPAN)
1486 cancelPendingScopingEffort(); 1486 cancelPendingScopingEffort();
1487 #endif 1487 #endif
1488 } 1488 }
1489 1489
1490 #if ENABLE(OILPAN) 1490 #if ENABLE(OILPAN)
1491 DEFINE_TRACE(WebLocalFrameImpl) 1491 DEFINE_TRACE(WebLocalFrameImpl)
1492 { 1492 {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1554 frame()->tree().setPrecalculatedName(name, uniqueName); 1554 frame()->tree().setPrecalculatedName(name, uniqueName);
1555 // We must call init() after m_frame is assigned because it is referenced 1555 // 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 1556 // during init(). Note that this may dispatch JS events; the frame may be
1557 // detached after init() returns. 1557 // detached after init() returns.
1558 frame()->init(); 1558 frame()->init();
1559 } 1559 }
1560 1560
1561 PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const Fra meLoadRequest& request, 1561 PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const Fra meLoadRequest& request,
1562 const AtomicString& name, HTMLFrameOwnerElement* ownerElement) 1562 const AtomicString& name, HTMLFrameOwnerElement* ownerElement)
1563 { 1563 {
1564 ASSERT(m_client); 1564 DCHECK(m_client);
1565 TRACE_EVENT0("blink", "WebLocalFrameImpl::createChildframe"); 1565 TRACE_EVENT0("blink", "WebLocalFrameImpl::createChildframe");
1566 WebTreeScopeType scope = frame()->document() == ownerElement->treeScope() 1566 WebTreeScopeType scope = frame()->document() == ownerElement->treeScope()
1567 ? WebTreeScopeType::Document 1567 ? WebTreeScopeType::Document
1568 : WebTreeScopeType::Shadow; 1568 : WebTreeScopeType::Shadow;
1569 WebFrameOwnerProperties ownerProperties(ownerElement->scrollingMode(), owner Element->marginWidth(), ownerElement->marginHeight()); 1569 WebFrameOwnerProperties ownerProperties(ownerElement->scrollingMode(), owner Element->marginWidth(), ownerElement->marginHeight());
1570 // FIXME: Using subResourceAttributeName as fallback is not a perfect 1570 // FIXME: Using subResourceAttributeName as fallback is not a perfect
1571 // solution. subResourceAttributeName returns just one attribute name. The 1571 // solution. subResourceAttributeName returns just one attribute name. The
1572 // element might not have the attribute, and there might be other attributes 1572 // element might not have the attribute, and there might be other attributes
1573 // which can identify the element. 1573 // which can identify the element.
1574 AtomicString uniqueName = frame()->tree().calculateUniqueNameForNewChildFram e( 1574 AtomicString uniqueName = frame()->tree().calculateUniqueNameForNewChildFram e(
(...skipping 28 matching lines...) Expand all
1603 // detached by script in the page. 1603 // detached by script in the page.
1604 if (!webframeChild->parent()) 1604 if (!webframeChild->parent())
1605 return nullptr; 1605 return nullptr;
1606 return webframeChild->frame(); 1606 return webframeChild->frame();
1607 } 1607 }
1608 1608
1609 void WebLocalFrameImpl::didChangeContentsSize(const IntSize& size) 1609 void WebLocalFrameImpl::didChangeContentsSize(const IntSize& size)
1610 { 1610 {
1611 // This is only possible on the main frame. 1611 // This is only possible on the main frame.
1612 if (m_textFinder && m_textFinder->totalMatchCount() > 0) { 1612 if (m_textFinder && m_textFinder->totalMatchCount() > 0) {
1613 ASSERT(!parent()); 1613 DCHECK(!parent());
1614 m_textFinder->increaseMarkerVersion(); 1614 m_textFinder->increaseMarkerVersion();
1615 } 1615 }
1616 } 1616 }
1617 1617
1618 void WebLocalFrameImpl::createFrameView() 1618 void WebLocalFrameImpl::createFrameView()
1619 { 1619 {
1620 TRACE_EVENT0("blink", "WebLocalFrameImpl::createFrameView"); 1620 TRACE_EVENT0("blink", "WebLocalFrameImpl::createFrameView");
1621 1621
1622 ASSERT(frame()); // If frame() doesn't exist, we probably didn't init proper ly. 1622 DCHECK(frame()); // If frame() doesn't exist, we probably didn't init proper ly.
1623 1623
1624 WebViewImpl* webView = viewImpl(); 1624 WebViewImpl* webView = viewImpl();
1625 1625
1626 bool isMainFrame = !parent(); 1626 bool isMainFrame = !parent();
1627 IntSize initialSize = (isMainFrame || !frameWidget()) ? webView->mainFrameSi ze() : (IntSize)frameWidget()->size(); 1627 IntSize initialSize = (isMainFrame || !frameWidget()) ? webView->mainFrameSi ze() : (IntSize)frameWidget()->size();
1628 bool isTransparent = !isMainFrame && parent()->isWebRemoteFrame() ? true : w ebView->isTransparent(); 1628 bool isTransparent = !isMainFrame && parent()->isWebRemoteFrame() ? true : w ebView->isTransparent();
1629 1629
1630 frame()->createView(initialSize, webView->baseBackgroundColor(), isTranspare nt); 1630 frame()->createView(initialSize, webView->baseBackgroundColor(), isTranspare nt);
1631 if (webView->shouldAutoResize() && frame()->isLocalRoot()) 1631 if (webView->shouldAutoResize() && frame()->isLocalRoot())
1632 frame()->view()->enableAutoSizeMode(webView->minAutoSize(), webView->max AutoSize()); 1632 frame()->view()->enableAutoSizeMode(webView->minAutoSize(), webView->max AutoSize());
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1830 m_autofillClient = autofillClient; 1830 m_autofillClient = autofillClient;
1831 } 1831 }
1832 1832
1833 WebAutofillClient* WebLocalFrameImpl::autofillClient() 1833 WebAutofillClient* WebLocalFrameImpl::autofillClient()
1834 { 1834 {
1835 return m_autofillClient; 1835 return m_autofillClient;
1836 } 1836 }
1837 1837
1838 void WebLocalFrameImpl::setDevToolsAgentClient(WebDevToolsAgentClient* devToolsC lient) 1838 void WebLocalFrameImpl::setDevToolsAgentClient(WebDevToolsAgentClient* devToolsC lient)
1839 { 1839 {
1840 ASSERT(devToolsClient); 1840 DCHECK(devToolsClient);
1841 m_devToolsAgent = WebDevToolsAgentImpl::create(this, devToolsClient); 1841 m_devToolsAgent = WebDevToolsAgentImpl::create(this, devToolsClient);
1842 } 1842 }
1843 1843
1844 WebDevToolsAgent* WebLocalFrameImpl::devToolsAgent() 1844 WebDevToolsAgent* WebLocalFrameImpl::devToolsAgent()
1845 { 1845 {
1846 return m_devToolsAgent.get(); 1846 return m_devToolsAgent.get();
1847 } 1847 }
1848 1848
1849 void WebLocalFrameImpl::setFrameOwnerProperties(const WebFrameOwnerProperties& f rameOwnerProperties) 1849 void WebLocalFrameImpl::setFrameOwnerProperties(const WebFrameOwnerProperties& f rameOwnerProperties)
1850 { 1850 {
1851 // At the moment, this is only used to replicate frame owner properties 1851 // At the moment, this is only used to replicate frame owner properties
1852 // for frames with a remote owner. 1852 // for frames with a remote owner.
1853 FrameOwner* owner = frame()->owner(); 1853 FrameOwner* owner = frame()->owner();
1854 ASSERT(owner); 1854 DCHECK(owner);
1855 toRemoteFrameOwner(owner)->setScrollingMode(frameOwnerProperties.scrollingMo de); 1855 toRemoteFrameOwner(owner)->setScrollingMode(frameOwnerProperties.scrollingMo de);
1856 toRemoteFrameOwner(owner)->setMarginWidth(frameOwnerProperties.marginWidth); 1856 toRemoteFrameOwner(owner)->setMarginWidth(frameOwnerProperties.marginWidth);
1857 toRemoteFrameOwner(owner)->setMarginHeight(frameOwnerProperties.marginHeight ); 1857 toRemoteFrameOwner(owner)->setMarginHeight(frameOwnerProperties.marginHeight );
1858 } 1858 }
1859 1859
1860 WebLocalFrameImpl* WebLocalFrameImpl::localRoot() 1860 WebLocalFrameImpl* WebLocalFrameImpl::localRoot()
1861 { 1861 {
1862 // This can't use the LocalFrame::localFrameRoot, since it may be called 1862 // This can't use the LocalFrame::localFrameRoot, since it may be called
1863 // when the WebLocalFrame exists but the core LocalFrame does not. 1863 // when the WebLocalFrame exists but the core LocalFrame does not.
1864 // TODO(alexmos, dcheng): Clean this up to only calculate this in one place. 1864 // 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 1879 WebLocalFrame* WebLocalFrameImpl::traverseNextLocal(bool wrap) const
1880 { 1880 {
1881 WebFrame* nextLocalFrame = this->traverseNext(wrap); 1881 WebFrame* nextLocalFrame = this->traverseNext(wrap);
1882 while (nextLocalFrame && !nextLocalFrame->isWebLocalFrame()) 1882 while (nextLocalFrame && !nextLocalFrame->isWebLocalFrame())
1883 nextLocalFrame = nextLocalFrame->traverseNext(wrap); 1883 nextLocalFrame = nextLocalFrame->traverseNext(wrap);
1884 return nextLocalFrame ? nextLocalFrame->toWebLocalFrame() : nullptr; 1884 return nextLocalFrame ? nextLocalFrame->toWebLocalFrame() : nullptr;
1885 } 1885 }
1886 1886
1887 void WebLocalFrameImpl::sendPings(const WebNode& contextNode, const WebURL& dest inationURL) 1887 void WebLocalFrameImpl::sendPings(const WebNode& contextNode, const WebURL& dest inationURL)
1888 { 1888 {
1889 ASSERT(frame()); 1889 DCHECK(frame());
1890 Element* anchor = contextNode.constUnwrap<Node>()->enclosingLinkEventParentO rSelf(); 1890 Element* anchor = contextNode.constUnwrap<Node>()->enclosingLinkEventParentO rSelf();
1891 if (isHTMLAnchorElement(anchor)) 1891 if (isHTMLAnchorElement(anchor))
1892 toHTMLAnchorElement(anchor)->sendPings(destinationURL); 1892 toHTMLAnchorElement(anchor)->sendPings(destinationURL);
1893 } 1893 }
1894 1894
1895 WebURLRequest WebLocalFrameImpl::requestFromHistoryItem(const WebHistoryItem& it em, 1895 WebURLRequest WebLocalFrameImpl::requestFromHistoryItem(const WebHistoryItem& it em,
1896 WebURLRequest::CachePolicy cachePolicy) const 1896 WebURLRequest::CachePolicy cachePolicy) const
1897 { 1897 {
1898 RefPtrWillBeRawPtr<HistoryItem> historyItem = PassRefPtrWillBeRawPtr<History Item>(item); 1898 RefPtrWillBeRawPtr<HistoryItem> historyItem = PassRefPtrWillBeRawPtr<History Item>(item);
1899 ResourceRequest request = FrameLoader::resourceRequestFromHistoryItem( 1899 ResourceRequest request = FrameLoader::resourceRequestFromHistoryItem(
1900 historyItem.get(), static_cast<ResourceRequestCachePolicy>(cachePolicy)) ; 1900 historyItem.get(), static_cast<ResourceRequestCachePolicy>(cachePolicy)) ;
1901 return WrappedResourceRequest(request); 1901 return WrappedResourceRequest(request);
1902 } 1902 }
1903 1903
1904 WebURLRequest WebLocalFrameImpl::requestForReload(WebFrameLoadType loadType, 1904 WebURLRequest WebLocalFrameImpl::requestForReload(WebFrameLoadType loadType,
1905 const WebURL& overrideUrl) const 1905 const WebURL& overrideUrl) const
1906 { 1906 {
1907 ASSERT(frame()); 1907 DCHECK(frame());
1908 ResourceRequest request = frame()->loader().resourceRequestForReload( 1908 ResourceRequest request = frame()->loader().resourceRequestForReload(
1909 static_cast<FrameLoadType>(loadType), overrideUrl); 1909 static_cast<FrameLoadType>(loadType), overrideUrl);
1910 return WrappedResourceRequest(request); 1910 return WrappedResourceRequest(request);
1911 } 1911 }
1912 1912
1913 void WebLocalFrameImpl::load(const WebURLRequest& request, WebFrameLoadType webF rameLoadType, 1913 void WebLocalFrameImpl::load(const WebURLRequest& request, WebFrameLoadType webF rameLoadType,
1914 const WebHistoryItem& item, WebHistoryLoadType webHistoryLoadType, bool isCl ientRedirect) 1914 const WebHistoryItem& item, WebHistoryLoadType webHistoryLoadType, bool isCl ientRedirect)
1915 { 1915 {
1916 ASSERT(frame()); 1916 DCHECK(frame());
1917 ASSERT(!request.isNull()); 1917 DCHECK(!request.isNull());
1918 const ResourceRequest& resourceRequest = request.toResourceRequest(); 1918 const ResourceRequest& resourceRequest = request.toResourceRequest();
1919 1919
1920 if (resourceRequest.url().protocolIs("javascript") 1920 if (resourceRequest.url().protocolIs("javascript")
1921 && webFrameLoadType == WebFrameLoadType::Standard) { 1921 && webFrameLoadType == WebFrameLoadType::Standard) {
1922 loadJavaScriptURL(resourceRequest.url()); 1922 loadJavaScriptURL(resourceRequest.url());
1923 return; 1923 return;
1924 } 1924 }
1925 1925
1926 FrameLoadRequest frameRequest = FrameLoadRequest(nullptr, resourceRequest); 1926 FrameLoadRequest frameRequest = FrameLoadRequest(nullptr, resourceRequest);
1927 if (isClientRedirect) 1927 if (isClientRedirect)
1928 frameRequest.setClientRedirect(ClientRedirect); 1928 frameRequest.setClientRedirect(ClientRedirect);
1929 RefPtrWillBeRawPtr<HistoryItem> historyItem = PassRefPtrWillBeRawPtr<History Item>(item); 1929 RefPtrWillBeRawPtr<HistoryItem> historyItem = PassRefPtrWillBeRawPtr<History Item>(item);
1930 frame()->loader().load( 1930 frame()->loader().load(
1931 frameRequest, static_cast<FrameLoadType>(webFrameLoadType), historyItem. get(), 1931 frameRequest, static_cast<FrameLoadType>(webFrameLoadType), historyItem. get(),
1932 static_cast<HistoryLoadType>(webHistoryLoadType)); 1932 static_cast<HistoryLoadType>(webHistoryLoadType));
1933 } 1933 }
1934 1934
1935 void WebLocalFrameImpl::loadData(const WebData& data, const WebString& mimeType, 1935 void WebLocalFrameImpl::loadData(const WebData& data, const WebString& mimeType,
1936 const WebString& textEncoding, const WebURL& baseURL, const WebURL& unreacha bleURL, bool replace, 1936 const WebString& textEncoding, const WebURL& baseURL, const WebURL& unreacha bleURL, bool replace,
1937 WebFrameLoadType webFrameLoadType, const WebHistoryItem& item, 1937 WebFrameLoadType webFrameLoadType, const WebHistoryItem& item,
1938 WebHistoryLoadType webHistoryLoadType, bool isClientRedirect) 1938 WebHistoryLoadType webHistoryLoadType, bool isClientRedirect)
1939 { 1939 {
1940 ASSERT(frame()); 1940 DCHECK(frame());
1941 1941
1942 // If we are loading substitute data to replace an existing load, then 1942 // If we are loading substitute data to replace an existing load, then
1943 // inherit all of the properties of that original request. This way, 1943 // inherit all of the properties of that original request. This way,
1944 // reload will re-attempt the original request. It is essential that 1944 // 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 1945 // we only do this when there is an unreachableURL since a non-empty
1946 // unreachableURL informs FrameLoader::reload to load unreachableURL 1946 // unreachableURL informs FrameLoader::reload to load unreachableURL
1947 // instead of the currently loaded URL. 1947 // instead of the currently loaded URL.
1948 ResourceRequest request; 1948 ResourceRequest request;
1949 if (replace && !unreachableURL.isEmpty() && frame()->loader().provisionalDoc umentLoader()) 1949 if (replace && !unreachableURL.isEmpty() && frame()->loader().provisionalDoc umentLoader())
1950 request = frame()->loader().provisionalDocumentLoader()->originalRequest (); 1950 request = frame()->loader().provisionalDocumentLoader()->originalRequest ();
1951 request.setURL(baseURL); 1951 request.setURL(baseURL);
1952 request.setCheckForBrowserSideNavigation(false); 1952 request.setCheckForBrowserSideNavigation(false);
1953 1953
1954 FrameLoadRequest frameRequest(0, request, SubstituteData(data, mimeType, tex tEncoding, unreachableURL)); 1954 FrameLoadRequest frameRequest(0, request, SubstituteData(data, mimeType, tex tEncoding, unreachableURL));
1955 ASSERT(frameRequest.substituteData().isValid()); 1955 DCHECK(frameRequest.substituteData().isValid());
1956 frameRequest.setReplacesCurrentItem(replace); 1956 frameRequest.setReplacesCurrentItem(replace);
1957 if (isClientRedirect) 1957 if (isClientRedirect)
1958 frameRequest.setClientRedirect(ClientRedirect); 1958 frameRequest.setClientRedirect(ClientRedirect);
1959 1959
1960 RefPtrWillBeRawPtr<HistoryItem> historyItem = PassRefPtrWillBeRawPtr<History Item>(item); 1960 RefPtrWillBeRawPtr<HistoryItem> historyItem = PassRefPtrWillBeRawPtr<History Item>(item);
1961 frame()->loader().load( 1961 frame()->loader().load(
1962 frameRequest, static_cast<FrameLoadType>(webFrameLoadType), historyItem. get(), 1962 frameRequest, static_cast<FrameLoadType>(webFrameLoadType), historyItem. get(),
1963 static_cast<HistoryLoadType>(webHistoryLoadType)); 1963 static_cast<HistoryLoadType>(webHistoryLoadType));
1964 } 1964 }
1965 1965
(...skipping 11 matching lines...) Expand all
1977 return frame()->document()->fetcher()->requestCount(); 1977 return frame()->document()->fetcher()->requestCount();
1978 } 1978 }
1979 1979
1980 bool WebLocalFrameImpl::isNavigationScheduledWithin(double intervalInSeconds) co nst 1980 bool WebLocalFrameImpl::isNavigationScheduledWithin(double intervalInSeconds) co nst
1981 { 1981 {
1982 return frame() && frame()->navigationScheduler().isNavigationScheduledWithin (intervalInSeconds); 1982 return frame() && frame()->navigationScheduler().isNavigationScheduledWithin (intervalInSeconds);
1983 } 1983 }
1984 1984
1985 void WebLocalFrameImpl::setCommittedFirstRealLoad() 1985 void WebLocalFrameImpl::setCommittedFirstRealLoad()
1986 { 1986 {
1987 ASSERT(frame()); 1987 DCHECK(frame());
1988 ensureFrameLoaderHasCommitted(frame()->loader()); 1988 ensureFrameLoaderHasCommitted(frame()->loader());
1989 } 1989 }
1990 1990
1991 void WebLocalFrameImpl::sendOrientationChangeEvent() 1991 void WebLocalFrameImpl::sendOrientationChangeEvent()
1992 { 1992 {
1993 if (!frame()) 1993 if (!frame())
1994 return; 1994 return;
1995 1995
1996 // Screen Orientation API 1996 // Screen Orientation API
1997 if (ScreenOrientationController::from(*frame())) 1997 if (ScreenOrientationController::from(*frame()))
1998 ScreenOrientationController::from(*frame())->notifyOrientationChanged(); 1998 ScreenOrientationController::from(*frame())->notifyOrientationChanged();
1999 1999
2000 // Legacy window.orientation API 2000 // Legacy window.orientation API
2001 if (RuntimeEnabledFeatures::orientationEventEnabled() && frame()->domWindow( )) 2001 if (RuntimeEnabledFeatures::orientationEventEnabled() && frame()->domWindow( ))
2002 frame()->localDOMWindow()->sendOrientationChangeEvent(); 2002 frame()->localDOMWindow()->sendOrientationChangeEvent();
2003 } 2003 }
2004 2004
2005 void WebLocalFrameImpl::willShowInstallBannerPrompt(int requestId, const WebVect or<WebString>& platforms, WebAppBannerPromptReply* reply) 2005 void WebLocalFrameImpl::willShowInstallBannerPrompt(int requestId, const WebVect or<WebString>& platforms, WebAppBannerPromptReply* reply)
2006 { 2006 {
2007 if (!RuntimeEnabledFeatures::appBannerEnabled() || !frame()) 2007 if (!RuntimeEnabledFeatures::appBannerEnabled() || !frame())
2008 return; 2008 return;
2009 2009
2010 AppBannerController::willShowInstallBannerPrompt(requestId, client()->appBan nerClient(), frame(), platforms, reply); 2010 AppBannerController::willShowInstallBannerPrompt(requestId, client()->appBan nerClient(), frame(), platforms, reply);
2011 } 2011 }
2012 2012
2013 void WebLocalFrameImpl::requestRunTask(WebSuspendableTask* task) const 2013 void WebLocalFrameImpl::requestRunTask(WebSuspendableTask* task) const
2014 { 2014 {
2015 ASSERT(frame()); 2015 DCHECK(frame());
2016 ASSERT(frame()->document()); 2016 DCHECK(frame()->document());
2017 frame()->document()->postSuspendableTask(WebSuspendableTaskWrapper::create(a doptPtr(task))); 2017 frame()->document()->postSuspendableTask(WebSuspendableTaskWrapper::create(a doptPtr(task)));
2018 } 2018 }
2019 2019
2020 void WebLocalFrameImpl::didCallAddSearchProvider() 2020 void WebLocalFrameImpl::didCallAddSearchProvider()
2021 { 2021 {
2022 UseCounter::count(frame(), UseCounter::ExternalAddSearchProvider); 2022 UseCounter::count(frame(), UseCounter::ExternalAddSearchProvider);
2023 } 2023 }
2024 2024
2025 void WebLocalFrameImpl::didCallIsSearchProviderInstalled() 2025 void WebLocalFrameImpl::didCallIsSearchProviderInstalled()
2026 { 2026 {
(...skipping 21 matching lines...) Expand all
2048 2048
2049 void WebLocalFrameImpl::cancelPendingScopingEffort() 2049 void WebLocalFrameImpl::cancelPendingScopingEffort()
2050 { 2050 {
2051 if (m_textFinder) 2051 if (m_textFinder)
2052 m_textFinder->cancelPendingScopingEffort(); 2052 m_textFinder->cancelPendingScopingEffort();
2053 } 2053 }
2054 2054
2055 void WebLocalFrameImpl::increaseMatchCount(int count, int identifier) 2055 void WebLocalFrameImpl::increaseMatchCount(int count, int identifier)
2056 { 2056 {
2057 // This function should only be called on the mainframe. 2057 // This function should only be called on the mainframe.
2058 ASSERT(!parent()); 2058 DCHECK(!parent());
2059 ensureTextFinder().increaseMatchCount(identifier, count); 2059 ensureTextFinder().increaseMatchCount(identifier, count);
2060 } 2060 }
2061 2061
2062 void WebLocalFrameImpl::resetMatchCount() 2062 void WebLocalFrameImpl::resetMatchCount()
2063 { 2063 {
2064 ensureTextFinder().resetMatchCount(); 2064 ensureTextFinder().resetMatchCount();
2065 } 2065 }
2066 2066
2067 void WebLocalFrameImpl::dispatchMessageEventWithOriginCheck(const WebSecurityOri gin& intendedTargetOrigin, const WebDOMEvent& event) 2067 void WebLocalFrameImpl::dispatchMessageEventWithOriginCheck(const WebSecurityOri gin& intendedTargetOrigin, const WebDOMEvent& event)
2068 { 2068 {
2069 ASSERT(!event.isNull()); 2069 DCHECK(!event.isNull());
2070 frame()->localDOMWindow()->dispatchMessageEventWithOriginCheck(intendedTarge tOrigin.get(), event, nullptr); 2070 frame()->localDOMWindow()->dispatchMessageEventWithOriginCheck(intendedTarge tOrigin.get(), event, nullptr);
2071 } 2071 }
2072 2072
2073 int WebLocalFrameImpl::findMatchMarkersVersion() const 2073 int WebLocalFrameImpl::findMatchMarkersVersion() const
2074 { 2074 {
2075 ASSERT(!parent()); 2075 DCHECK(!parent());
2076 2076
2077 if (m_textFinder) 2077 if (m_textFinder)
2078 return m_textFinder->findMatchMarkersVersion(); 2078 return m_textFinder->findMatchMarkersVersion();
2079 return 0; 2079 return 0;
2080 } 2080 }
2081 2081
2082 int WebLocalFrameImpl::selectNearestFindMatch(const WebFloatPoint& point, WebRec t* selectionRect) 2082 int WebLocalFrameImpl::selectNearestFindMatch(const WebFloatPoint& point, WebRec t* selectionRect)
2083 { 2083 {
2084 ASSERT(!parent()); 2084 DCHECK(!parent());
2085 return ensureTextFinder().selectNearestFindMatch(point, selectionRect); 2085 return ensureTextFinder().selectNearestFindMatch(point, selectionRect);
2086 } 2086 }
2087 2087
2088 WebFloatRect WebLocalFrameImpl::activeFindMatchRect() 2088 WebFloatRect WebLocalFrameImpl::activeFindMatchRect()
2089 { 2089 {
2090 ASSERT(!parent()); 2090 DCHECK(!parent());
2091 2091
2092 if (m_textFinder) 2092 if (m_textFinder)
2093 return m_textFinder->activeFindMatchRect(); 2093 return m_textFinder->activeFindMatchRect();
2094 return WebFloatRect(); 2094 return WebFloatRect();
2095 } 2095 }
2096 2096
2097 void WebLocalFrameImpl::findMatchRects(WebVector<WebFloatRect>& outputRects) 2097 void WebLocalFrameImpl::findMatchRects(WebVector<WebFloatRect>& outputRects)
2098 { 2098 {
2099 ASSERT(!parent()); 2099 DCHECK(!parent());
2100 ensureTextFinder().findMatchRects(outputRects); 2100 ensureTextFinder().findMatchRects(outputRects);
2101 } 2101 }
2102 2102
2103 void WebLocalFrameImpl::setTickmarks(const WebVector<WebRect>& tickmarks) 2103 void WebLocalFrameImpl::setTickmarks(const WebVector<WebRect>& tickmarks)
2104 { 2104 {
2105 if (frameView()) { 2105 if (frameView()) {
2106 Vector<IntRect> tickmarksConverted(tickmarks.size()); 2106 Vector<IntRect> tickmarksConverted(tickmarks.size());
2107 for (size_t i = 0; i < tickmarks.size(); ++i) 2107 for (size_t i = 0; i < tickmarks.size(); ++i)
2108 tickmarksConverted[i] = tickmarks[i]; 2108 tickmarksConverted[i] = tickmarks[i];
2109 frameView()->setTickmarks(tickmarksConverted); 2109 frameView()->setTickmarks(tickmarksConverted);
(...skipping 15 matching lines...) Expand all
2125 // There is a possibility that the frame being detached was the only 2125 // 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. 2126 // pending one. We need to make sure final replies can be sent.
2127 m_textFinder->flushCurrentScoping(); 2127 m_textFinder->flushCurrentScoping();
2128 2128
2129 m_textFinder->cancelPendingScopingEffort(); 2129 m_textFinder->cancelPendingScopingEffort();
2130 } 2130 }
2131 } 2131 }
2132 2132
2133 WebLocalFrameImpl* WebLocalFrameImpl::activeMatchFrame() const 2133 WebLocalFrameImpl* WebLocalFrameImpl::activeMatchFrame() const
2134 { 2134 {
2135 ASSERT(!parent()); 2135 DCHECK(!parent());
2136 2136
2137 if (m_textFinder) 2137 if (m_textFinder)
2138 return m_textFinder->activeMatchFrame(); 2138 return m_textFinder->activeMatchFrame();
2139 return 0; 2139 return 0;
2140 } 2140 }
2141 2141
2142 Range* WebLocalFrameImpl::activeMatch() const 2142 Range* WebLocalFrameImpl::activeMatch() const
2143 { 2143 {
2144 if (m_textFinder) 2144 if (m_textFinder)
2145 return m_textFinder->activeMatch(); 2145 return m_textFinder->activeMatch();
(...skipping 24 matching lines...) Expand all
2170 return WebSandboxFlags::None; 2170 return WebSandboxFlags::None;
2171 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags( )); 2171 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags( ));
2172 } 2172 }
2173 2173
2174 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags) 2174 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags)
2175 { 2175 {
2176 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); 2176 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags));
2177 } 2177 }
2178 2178
2179 } // namespace blink 2179 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698