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

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

Issue 25505007: Remove bogus use of the term "user style" in Blink and Blink API (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Patch for landing Created 7 years, 2 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/AssertMatchingEnums.cpp ('k') | public/web/WebView.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) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 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 3643 matching lines...) Expand 10 before | Expand all | Expand 10 after
3654 void WebViewImpl::setSelectionColors(unsigned activeBackgroundColor, 3654 void WebViewImpl::setSelectionColors(unsigned activeBackgroundColor,
3655 unsigned activeForegroundColor, 3655 unsigned activeForegroundColor,
3656 unsigned inactiveBackgroundColor, 3656 unsigned inactiveBackgroundColor,
3657 unsigned inactiveForegroundColor) { 3657 unsigned inactiveForegroundColor) {
3658 #if ENABLE(DEFAULT_RENDER_THEME) 3658 #if ENABLE(DEFAULT_RENDER_THEME)
3659 RenderThemeChromiumDefault::setSelectionColors(activeBackgroundColor, active ForegroundColor, inactiveBackgroundColor, inactiveForegroundColor); 3659 RenderThemeChromiumDefault::setSelectionColors(activeBackgroundColor, active ForegroundColor, inactiveBackgroundColor, inactiveForegroundColor);
3660 RenderTheme::theme().platformColorsDidChange(); 3660 RenderTheme::theme().platformColorsDidChange();
3661 #endif 3661 #endif
3662 } 3662 }
3663 3663
3664 void WebView::addUserStyleSheet(const WebString& sourceCode, 3664 void WebView::injectStyleSheet(const WebString& sourceCode, const WebVector<WebS tring>& patternsIn, WebView::StyleInjectionTarget injectIn)
3665 const WebVector<WebString>& patternsIn,
3666 WebView::UserContentInjectIn injectIn,
3667 WebView::UserStyleInjectionTime injectionTime)
3668 { 3665 {
3669 Vector<String> patterns; 3666 Vector<String> patterns;
3670 for (size_t i = 0; i < patternsIn.size(); ++i) 3667 for (size_t i = 0; i < patternsIn.size(); ++i)
3671 patterns.append(patternsIn[i]); 3668 patterns.append(patternsIn[i]);
3672 3669
3673 PageGroup* pageGroup = PageGroup::sharedGroup(); 3670 PageGroup* pageGroup = PageGroup::sharedGroup();
3671 pageGroup->injectStyleSheet(sourceCode, patterns, static_cast<WebCore::Style InjectionTarget>(injectIn));
3672 }
3674 3673
3675 // FIXME: Current callers always want the level to be "author". It probably makes sense to let 3674 void WebView::removeInjectedStyleSheets()
3676 // callers specify this though, since in other cases the caller will probabl y want "user" level. 3675 {
3677 // 3676 PageGroup::sharedGroup()->removeInjectedStyleSheets();
3678 // FIXME: It would be nice to populate the URL correctly, instead of passing an empty URL. 3677 }
3679 pageGroup->addUserStyleSheet(sourceCode, WebURL(), patterns, Vector<String>( ), 3678
3680 static_cast<UserContentInjectedFrames>(injectIn ), 3679 void WebView::addUserStyleSheet(const WebString& sourceCode, const WebVector<Web String>& patternsIn, WebView::UserContentInjectIn injectIn, WebView::UserStyleIn jectionTime)
3681 UserStyleAuthorLevel, 3680 {
3682 static_cast<WebCore::UserStyleInjectionTime>(in jectionTime)); 3681 injectStyleSheet(sourceCode, patternsIn, injectIn == UserContentInjectInAllF rames ? InjectStyleInAllFrames : InjectStyleInTopFrameOnly);
3683 } 3682 }
3684 3683
3685 void WebView::removeAllUserContent() 3684 void WebView::removeAllUserContent()
3686 { 3685 {
3687 PageGroup::sharedGroup()->removeAllUserContent(); 3686 removeInjectedStyleSheets();
3688 } 3687 }
3689 3688
3690 void WebViewImpl::didCommitLoad(bool* isNewNavigation, bool isNavigationWithinPa ge) 3689 void WebViewImpl::didCommitLoad(bool* isNewNavigation, bool isNavigationWithinPa ge)
3691 { 3690 {
3692 if (isNewNavigation) 3691 if (isNewNavigation)
3693 *isNewNavigation = m_observedNewNavigation; 3692 *isNewNavigation = m_observedNewNavigation;
3694 3693
3695 #ifndef NDEBUG 3694 #ifndef NDEBUG
3696 ASSERT(!m_observedNewNavigation 3695 ASSERT(!m_observedNewNavigation
3697 || m_page->mainFrame()->loader()->documentLoader() == m_newNavigationLoa der); 3696 || m_page->mainFrame()->loader()->documentLoader() == m_newNavigationLoa der);
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
4204 // the initial viewport width. 4203 // the initial viewport width.
4205 // 2. The author has disabled viewport zoom. 4204 // 2. The author has disabled viewport zoom.
4206 4205
4207 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4206 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4208 4207
4209 return fixedLayoutSize().width == m_size.width 4208 return fixedLayoutSize().width == m_size.width
4210 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4209 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4211 } 4210 }
4212 4211
4213 } // namespace WebKit 4212 } // namespace WebKit
OLDNEW
« no previous file with comments | « Source/web/AssertMatchingEnums.cpp ('k') | public/web/WebView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698