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

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameView.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
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp » ('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) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Dirk Mueller <mueller@kde.org> 5 * 2000 Dirk Mueller <mueller@kde.org>
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * Copyright (C) 2009 Google Inc. All rights reserved. 9 * Copyright (C) 2009 Google Inc. All rights reserved.
10 * 10 *
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 153
154 using namespace HTMLNames; 154 using namespace HTMLNames;
155 155
156 // The maximum number of updatePlugins iterations that should be done before 156 // The maximum number of updatePlugins iterations that should be done before
157 // returning. 157 // returning.
158 static const unsigned maxUpdatePluginsIterations = 2; 158 static const unsigned maxUpdatePluginsIterations = 2;
159 static const double resourcePriorityUpdateDelayAfterScroll = 0.250; 159 static const double resourcePriorityUpdateDelayAfterScroll = 0.250;
160 160
161 static bool s_initialTrackAllPaintInvalidations = false; 161 static bool s_initialTrackAllPaintInvalidations = false;
162 162
163 static void setNeedsCompositingUpdate(LayoutViewItem layoutViewItem,
chrishtr 2017/04/06 17:33:46 I don't see much point in making this a helper met
Eric Seckler 2017/04/06 17:40:29 It was one before - I just moved it. Since it's us
chrishtr 2017/04/06 17:42:53 Oh, didn't see that. Ignore my comment.
164 CompositingUpdateType updateType) {
165 if (PaintLayerCompositor* compositor =
166 !layoutViewItem.isNull() ? layoutViewItem.compositor() : nullptr)
167 compositor->setNeedsCompositingUpdate(updateType);
168 }
169
163 FrameView::FrameView(LocalFrame& frame) 170 FrameView::FrameView(LocalFrame& frame)
164 : m_frame(frame), 171 : m_frame(frame),
165 m_displayMode(WebDisplayModeBrowser), 172 m_displayMode(WebDisplayModeBrowser),
166 m_canHaveScrollbars(true), 173 m_canHaveScrollbars(true),
167 m_hasPendingLayout(false), 174 m_hasPendingLayout(false),
168 m_inSynchronousPostLayout(false), 175 m_inSynchronousPostLayout(false),
169 m_postLayoutTasksTimer( 176 m_postLayoutTasksTimer(
170 TaskRunnerHelper::get(TaskType::UnspecedTimer, &frame), 177 TaskRunnerHelper::get(TaskType::UnspecedTimer, &frame),
171 this, 178 this,
172 &FrameView::postLayoutTimerFired), 179 &FrameView::postLayoutTimerFired),
(...skipping 2162 matching lines...) Expand 10 before | Expand all | Expand 10 after
2335 2342
2336 bool FrameView::hasOpaqueBackground() const { 2343 bool FrameView::hasOpaqueBackground() const {
2337 return !m_baseBackgroundColor.hasAlpha(); 2344 return !m_baseBackgroundColor.hasAlpha();
2338 } 2345 }
2339 2346
2340 Color FrameView::baseBackgroundColor() const { 2347 Color FrameView::baseBackgroundColor() const {
2341 return m_baseBackgroundColor; 2348 return m_baseBackgroundColor;
2342 } 2349 }
2343 2350
2344 void FrameView::setBaseBackgroundColor(const Color& backgroundColor) { 2351 void FrameView::setBaseBackgroundColor(const Color& backgroundColor) {
2352 if (m_baseBackgroundColor == backgroundColor)
2353 return;
2354
2345 m_baseBackgroundColor = backgroundColor; 2355 m_baseBackgroundColor = backgroundColor;
2346 2356
2347 if (!layoutViewItem().isNull() &&
2348 layoutViewItem().layer()->hasCompositedLayerMapping()) {
2349 CompositedLayerMapping* compositedLayerMapping =
2350 layoutViewItem().layer()->compositedLayerMapping();
2351 compositedLayerMapping->updateContentsOpaque();
2352 if (compositedLayerMapping->mainGraphicsLayer())
2353 compositedLayerMapping->mainGraphicsLayer()->setNeedsDisplay();
chrishtr 2017/04/06 17:33:46 You still need setNeedsDisplay in order to force i
Eric Seckler 2017/04/06 17:40:29 Thanks, will do!
2354 }
2355 recalculateScrollbarOverlayColorTheme(documentBackgroundColor()); 2357 recalculateScrollbarOverlayColorTheme(documentBackgroundColor());
2356 2358 setNeedsCompositingUpdate(layoutViewItem(), CompositingUpdateRebuildTree);
2357 if (!shouldThrottleRendering())
2358 page()->animator().scheduleVisualUpdate(m_frame.get());
2359 } 2359 }
2360 2360
2361 void FrameView::updateBaseBackgroundColorRecursively( 2361 void FrameView::updateBaseBackgroundColorRecursively(
2362 const Color& baseBackgroundColor) { 2362 const Color& baseBackgroundColor) {
2363 forAllNonThrottledFrameViews([baseBackgroundColor](FrameView& frameView) { 2363 forAllNonThrottledFrameViews([baseBackgroundColor](FrameView& frameView) {
2364 frameView.setBaseBackgroundColor(baseBackgroundColor); 2364 frameView.setBaseBackgroundColor(baseBackgroundColor);
2365 }); 2365 });
2366 } 2366 }
2367 2367
2368 void FrameView::scrollToFragmentAnchor() { 2368 void FrameView::scrollToFragmentAnchor() {
(...skipping 2266 matching lines...) Expand 10 before | Expand all | Expand 10 after
4635 4635
4636 IntPoint FrameView::convertFromContainingFrameViewBaseToScrollbar( 4636 IntPoint FrameView::convertFromContainingFrameViewBaseToScrollbar(
4637 const Scrollbar& scrollbar, 4637 const Scrollbar& scrollbar,
4638 const IntPoint& parentPoint) const { 4638 const IntPoint& parentPoint) const {
4639 IntPoint newPoint = parentPoint; 4639 IntPoint newPoint = parentPoint;
4640 // Scrollbars won't be transformed within us 4640 // Scrollbars won't be transformed within us
4641 newPoint.moveBy(-scrollbar.location()); 4641 newPoint.moveBy(-scrollbar.location());
4642 return newPoint; 4642 return newPoint;
4643 } 4643 }
4644 4644
4645 static void setNeedsCompositingUpdate(LayoutViewItem layoutViewItem,
4646 CompositingUpdateType updateType) {
4647 if (PaintLayerCompositor* compositor =
4648 !layoutViewItem.isNull() ? layoutViewItem.compositor() : nullptr)
4649 compositor->setNeedsCompositingUpdate(updateType);
4650 }
4651
4652 void FrameView::setParentVisible(bool visible) { 4645 void FrameView::setParentVisible(bool visible) {
4653 if (isParentVisible() == visible) 4646 if (isParentVisible() == visible)
4654 return; 4647 return;
4655 4648
4656 // As parent visibility changes, we may need to recomposite this frame view 4649 // As parent visibility changes, we may need to recomposite this frame view
4657 // and potentially child frame views. 4650 // and potentially child frame views.
4658 setNeedsCompositingUpdate(layoutViewItem(), CompositingUpdateRebuildTree); 4651 setNeedsCompositingUpdate(layoutViewItem(), CompositingUpdateRebuildTree);
4659 4652
4660 FrameViewBase::setParentVisible(visible); 4653 FrameViewBase::setParentVisible(visible);
4661 4654
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
5267 void FrameView::setAnimationHost( 5260 void FrameView::setAnimationHost(
5268 std::unique_ptr<CompositorAnimationHost> host) { 5261 std::unique_ptr<CompositorAnimationHost> host) {
5269 m_animationHost = std::move(host); 5262 m_animationHost = std::move(host);
5270 } 5263 }
5271 5264
5272 LayoutUnit FrameView::caretWidth() const { 5265 LayoutUnit FrameView::caretWidth() const {
5273 return LayoutUnit(getHostWindow()->windowToViewportScalar(1)); 5266 return LayoutUnit(getHostWindow()->windowToViewportScalar(1));
5274 } 5267 }
5275 5268
5276 } // namespace blink 5269 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698