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

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

Issue 2804983003: [blink] Use early returns in baseBackgroundColor(Override) setters. (Closed)
Patch Set: Created 3 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) 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 3579 matching lines...) Expand 10 before | Expand all | Expand 10 after
3590 3590
3591 void WebViewImpl::setBaseBackgroundColor(WebColor color) { 3591 void WebViewImpl::setBaseBackgroundColor(WebColor color) {
3592 if (m_baseBackgroundColor == color) 3592 if (m_baseBackgroundColor == color)
3593 return; 3593 return;
3594 3594
3595 m_baseBackgroundColor = color; 3595 m_baseBackgroundColor = color;
3596 updateBaseBackgroundColor(); 3596 updateBaseBackgroundColor();
3597 } 3597 }
3598 3598
3599 void WebViewImpl::setBaseBackgroundColorOverride(WebColor color) { 3599 void WebViewImpl::setBaseBackgroundColorOverride(WebColor color) {
3600 if (m_baseBackgroundColorOverrideEnabled &&
3601 m_baseBackgroundColorOverride == color) {
3602 return;
3603 }
3604
3600 m_baseBackgroundColorOverrideEnabled = true; 3605 m_baseBackgroundColorOverrideEnabled = true;
3601 m_baseBackgroundColorOverride = color; 3606 m_baseBackgroundColorOverride = color;
3602 if (mainFrameImpl()) { 3607 if (mainFrameImpl()) {
3603 // Force lifecycle update to ensure we're good to call 3608 // Force lifecycle update to ensure we're good to call
3604 // FrameView::setBaseBackgroundColor(). 3609 // FrameView::setBaseBackgroundColor().
3605 mainFrameImpl() 3610 mainFrameImpl()
3606 ->frame() 3611 ->frame()
3607 ->view() 3612 ->view()
3608 ->updateLifecycleToCompositingCleanPlusScrolling(); 3613 ->updateLifecycleToCompositingCleanPlusScrolling();
3609 } 3614 }
3610 updateBaseBackgroundColor(); 3615 updateBaseBackgroundColor();
3611 } 3616 }
3612 3617
3613 void WebViewImpl::clearBaseBackgroundColorOverride() { 3618 void WebViewImpl::clearBaseBackgroundColorOverride() {
3619 if (!m_baseBackgroundColorOverrideEnabled)
3620 return;
3621
3614 m_baseBackgroundColorOverrideEnabled = false; 3622 m_baseBackgroundColorOverrideEnabled = false;
3615 if (mainFrameImpl()) { 3623 if (mainFrameImpl()) {
3616 // Force lifecycle update to ensure we're good to call 3624 // Force lifecycle update to ensure we're good to call
3617 // FrameView::setBaseBackgroundColor(). 3625 // FrameView::setBaseBackgroundColor().
3618 mainFrameImpl() 3626 mainFrameImpl()
3619 ->frame() 3627 ->frame()
3620 ->view() 3628 ->view()
3621 ->updateLifecycleToCompositingCleanPlusScrolling(); 3629 ->updateLifecycleToCompositingCleanPlusScrolling();
3622 } 3630 }
3623 updateBaseBackgroundColor(); 3631 updateBaseBackgroundColor();
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
4232 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) 4240 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame())
4233 return nullptr; 4241 return nullptr;
4234 return focusedFrame; 4242 return focusedFrame;
4235 } 4243 }
4236 4244
4237 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { 4245 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const {
4238 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; 4246 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr;
4239 } 4247 }
4240 4248
4241 } // namespace blink 4249 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698