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

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

Issue 340213002: Move addStylesheetByURL from WebFrame to WebLocalFrame. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/web/WebLocalFrameImpl.h ('k') | Source/web/WebRemoteFrameImpl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 1316
1317 void WebLocalFrameImpl::extendSelectionAndDelete(int before, int after) 1317 void WebLocalFrameImpl::extendSelectionAndDelete(int before, int after)
1318 { 1318 {
1319 if (WebPlugin* plugin = focusedPluginIfInputMethodSupported()) { 1319 if (WebPlugin* plugin = focusedPluginIfInputMethodSupported()) {
1320 plugin->extendSelectionAndDelete(before, after); 1320 plugin->extendSelectionAndDelete(before, after);
1321 return; 1321 return;
1322 } 1322 }
1323 frame()->inputMethodController().extendSelectionAndDelete(before, after); 1323 frame()->inputMethodController().extendSelectionAndDelete(before, after);
1324 } 1324 }
1325 1325
1326 void WebLocalFrameImpl::addStyleSheetByURL(const WebString& url)
1327 {
1328 RefPtrWillBeRawPtr<Element> styleElement = frame()->document()->createElemen t(HTMLNames::linkTag, false);
1329
1330 styleElement->setAttribute(HTMLNames::typeAttr, "text/css");
1331 styleElement->setAttribute(HTMLNames::relAttr, "stylesheet");
1332 styleElement->setAttribute(HTMLNames::hrefAttr, url);
1333
1334 frame()->document()->head()->appendChild(styleElement.release(), IGNORE_EXCE PTION);
1335 }
1336
1337 void WebLocalFrameImpl::setCaretVisible(bool visible) 1326 void WebLocalFrameImpl::setCaretVisible(bool visible)
1338 { 1327 {
1339 frame()->selection().setCaretVisible(visible); 1328 frame()->selection().setCaretVisible(visible);
1340 } 1329 }
1341 1330
1342 VisiblePosition WebLocalFrameImpl::visiblePositionForWindowPoint(const WebPoint& point) 1331 VisiblePosition WebLocalFrameImpl::visiblePositionForWindowPoint(const WebPoint& point)
1343 { 1332 {
1344 // FIXME(bokan): crbug.com/371902 - These scale/pinch transforms shouldn't 1333 // FIXME(bokan): crbug.com/371902 - These scale/pinch transforms shouldn't
1345 // be ad hoc and explicit. 1334 // be ad hoc and explicit.
1346 PinchViewport& pinchViewport = frame()->page()->frameHost().pinchViewport(); 1335 PinchViewport& pinchViewport = frame()->page()->frameHost().pinchViewport();
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
1883 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture); 1872 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture);
1884 v8::HandleScope handleScope(toIsolate(frame())); 1873 v8::HandleScope handleScope(toIsolate(frame()));
1885 v8::Local<v8::Value> result = frame()->script().executeScriptInMainWorldAndR eturnValue(ScriptSourceCode(script)); 1874 v8::Local<v8::Value> result = frame()->script().executeScriptInMainWorldAndR eturnValue(ScriptSourceCode(script));
1886 if (result.IsEmpty() || !result->IsString()) 1875 if (result.IsEmpty() || !result->IsString())
1887 return; 1876 return;
1888 String scriptResult = toCoreString(v8::Handle<v8::String>::Cast(result)); 1877 String scriptResult = toCoreString(v8::Handle<v8::String>::Cast(result));
1889 if (!frame()->navigationScheduler().locationChangePending()) 1878 if (!frame()->navigationScheduler().locationChangePending())
1890 frame()->document()->loader()->replaceDocument(scriptResult, ownerDocume nt.get()); 1879 frame()->document()->loader()->replaceDocument(scriptResult, ownerDocume nt.get());
1891 } 1880 }
1892 1881
1882 void WebLocalFrameImpl::addStyleSheetByURL(const WebString& url)
1883 {
1884 RefPtrWillBeRawPtr<Element> styleElement = frame()->document()->createElemen t(HTMLNames::linkTag, false);
1885
1886 styleElement->setAttribute(HTMLNames::typeAttr, "text/css");
1887 styleElement->setAttribute(HTMLNames::relAttr, "stylesheet");
1888 styleElement->setAttribute(HTMLNames::hrefAttr, url);
1889
1890 frame()->document()->head()->appendChild(styleElement.release(), IGNORE_EXCE PTION);
1891 }
1892
1893 void WebLocalFrameImpl::willDetachParent() 1893 void WebLocalFrameImpl::willDetachParent()
1894 { 1894 {
1895 // Do not expect string scoping results from any frames that got detached 1895 // Do not expect string scoping results from any frames that got detached
1896 // in the middle of the operation. 1896 // in the middle of the operation.
1897 if (m_textFinder && m_textFinder->scopingInProgress()) { 1897 if (m_textFinder && m_textFinder->scopingInProgress()) {
1898 1898
1899 // There is a possibility that the frame being detached was the only 1899 // There is a possibility that the frame being detached was the only
1900 // pending one. We need to make sure final replies can be sent. 1900 // pending one. We need to make sure final replies can be sent.
1901 m_textFinder->flushCurrentScoping(); 1901 m_textFinder->flushCurrentScoping();
1902 1902
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1950 { 1950 {
1951 RefPtr<LocalFrame> frame = LocalFrame::create(&m_frameLoaderClientImpl, host , owner); 1951 RefPtr<LocalFrame> frame = LocalFrame::create(&m_frameLoaderClientImpl, host , owner);
1952 setWebCoreFrame(frame); 1952 setWebCoreFrame(frame);
1953 frame->tree().setName(name, fallbackName); 1953 frame->tree().setName(name, fallbackName);
1954 // May dispatch JS events; frame may be detached after this. 1954 // May dispatch JS events; frame may be detached after this.
1955 frame->init(); 1955 frame->init();
1956 return frame; 1956 return frame;
1957 } 1957 }
1958 1958
1959 } // namespace blink 1959 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebLocalFrameImpl.h ('k') | Source/web/WebRemoteFrameImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698