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

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 2715243004: [blink] Support (semi-)transparent background colors in WebView/Frame. (Closed)
Patch Set: address comments Created 3 years, 9 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) 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 m_hasPendingLayout(false), 167 m_hasPendingLayout(false),
168 m_inSynchronousPostLayout(false), 168 m_inSynchronousPostLayout(false),
169 m_postLayoutTasksTimer( 169 m_postLayoutTasksTimer(
170 TaskRunnerHelper::get(TaskType::UnspecedTimer, &frame), 170 TaskRunnerHelper::get(TaskType::UnspecedTimer, &frame),
171 this, 171 this,
172 &FrameView::postLayoutTimerFired), 172 &FrameView::postLayoutTimerFired),
173 m_updatePluginsTimer( 173 m_updatePluginsTimer(
174 TaskRunnerHelper::get(TaskType::UnspecedTimer, &frame), 174 TaskRunnerHelper::get(TaskType::UnspecedTimer, &frame),
175 this, 175 this,
176 &FrameView::updatePluginsTimerFired), 176 &FrameView::updatePluginsTimerFired),
177 m_isTransparent(false),
178 m_baseBackgroundColor(Color::white), 177 m_baseBackgroundColor(Color::white),
179 m_mediaType(MediaTypeNames::screen), 178 m_mediaType(MediaTypeNames::screen),
180 m_safeToPropagateScrollToParent(true), 179 m_safeToPropagateScrollToParent(true),
181 m_scrollCorner(nullptr), 180 m_scrollCorner(nullptr),
182 m_stickyPositionObjectCount(0), 181 m_stickyPositionObjectCount(0),
183 m_inputEventsScaleFactorForEmulation(1), 182 m_inputEventsScaleFactorForEmulation(1),
184 m_layoutSizeFixedToFrameSize(true), 183 m_layoutSizeFixedToFrameSize(true),
185 m_didScrollTimer(TaskRunnerHelper::get(TaskType::UnspecedTimer, &frame), 184 m_didScrollTimer(TaskRunnerHelper::get(TaskType::UnspecedTimer, &frame),
186 this, 185 this,
187 &FrameView::didScrollTimerFired), 186 &FrameView::didScrollTimerFired),
(...skipping 2130 matching lines...) Expand 10 before | Expand all | Expand 10 after
2318 LayoutViewItem layoutViewItem = this->layoutViewItem(); 2317 LayoutViewItem layoutViewItem = this->layoutViewItem();
2319 if (layoutViewItem.isNull()) 2318 if (layoutViewItem.isNull())
2320 return; 2319 return;
2321 // TODO(crbug.com/590856): It's still broken if we choose not to crash when 2320 // TODO(crbug.com/590856): It's still broken if we choose not to crash when
2322 // the check fails. 2321 // the check fails.
2323 if (!checkLayoutInvalidationIsAllowed()) 2322 if (!checkLayoutInvalidationIsAllowed())
2324 return; 2323 return;
2325 layoutViewItem.setNeedsLayout(LayoutInvalidationReason::Unknown); 2324 layoutViewItem.setNeedsLayout(LayoutInvalidationReason::Unknown);
2326 } 2325 }
2327 2326
2328 bool FrameView::isTransparent() const {
2329 return m_isTransparent;
2330 }
2331
2332 void FrameView::setTransparent(bool isTransparent) {
2333 m_isTransparent = isTransparent;
2334 DisableCompositingQueryAsserts disabler;
2335 if (!layoutViewItem().isNull() &&
2336 layoutViewItem().layer()->hasCompositedLayerMapping())
2337 layoutViewItem().layer()->compositedLayerMapping()->updateContentsOpaque();
2338 }
2339
2340 bool FrameView::hasOpaqueBackground() const { 2327 bool FrameView::hasOpaqueBackground() const {
2341 return !m_isTransparent && !m_baseBackgroundColor.hasAlpha(); 2328 return !m_baseBackgroundColor.hasAlpha();
2342 } 2329 }
2343 2330
2344 Color FrameView::baseBackgroundColor() const { 2331 Color FrameView::baseBackgroundColor() const {
2345 return m_baseBackgroundColor; 2332 return m_baseBackgroundColor;
2346 } 2333 }
2347 2334
2348 void FrameView::setBaseBackgroundColor(const Color& backgroundColor) { 2335 void FrameView::setBaseBackgroundColor(const Color& backgroundColor) {
2349 m_baseBackgroundColor = backgroundColor; 2336 m_baseBackgroundColor = backgroundColor;
2350 2337
2351 if (!layoutViewItem().isNull() && 2338 if (!layoutViewItem().isNull() &&
2352 layoutViewItem().layer()->hasCompositedLayerMapping()) { 2339 layoutViewItem().layer()->hasCompositedLayerMapping()) {
2353 CompositedLayerMapping* compositedLayerMapping = 2340 CompositedLayerMapping* compositedLayerMapping =
2354 layoutViewItem().layer()->compositedLayerMapping(); 2341 layoutViewItem().layer()->compositedLayerMapping();
2355 compositedLayerMapping->updateContentsOpaque(); 2342 compositedLayerMapping->updateContentsOpaque();
2356 if (compositedLayerMapping->mainGraphicsLayer()) 2343 if (compositedLayerMapping->mainGraphicsLayer())
2357 compositedLayerMapping->mainGraphicsLayer()->setNeedsDisplay(); 2344 compositedLayerMapping->mainGraphicsLayer()->setNeedsDisplay();
2358 } 2345 }
2359 recalculateScrollbarOverlayColorTheme(documentBackgroundColor()); 2346 recalculateScrollbarOverlayColorTheme(documentBackgroundColor());
2360 2347
2361 if (!shouldThrottleRendering()) 2348 if (!shouldThrottleRendering())
2362 page()->animator().scheduleVisualUpdate(m_frame.get()); 2349 page()->animator().scheduleVisualUpdate(m_frame.get());
2363 } 2350 }
2364 2351
2365 void FrameView::updateBackgroundRecursively(const Color& backgroundColor, 2352 void FrameView::updateBaseBackgroundColorRecursively(
2366 bool transparent) { 2353 const Color& baseBackgroundColor) {
2367 forAllNonThrottledFrameViews( 2354 forAllNonThrottledFrameViews([baseBackgroundColor](FrameView& frameView) {
2368 [backgroundColor, transparent](FrameView& frameView) { 2355 frameView.setBaseBackgroundColor(baseBackgroundColor);
2369 frameView.setTransparent(transparent); 2356 });
2370 frameView.setBaseBackgroundColor(backgroundColor);
2371 });
2372 } 2357 }
2373 2358
2374 void FrameView::scrollToFragmentAnchor() { 2359 void FrameView::scrollToFragmentAnchor() {
2375 Node* anchorNode = m_fragmentAnchor; 2360 Node* anchorNode = m_fragmentAnchor;
2376 if (!anchorNode) 2361 if (!anchorNode)
2377 return; 2362 return;
2378 2363
2379 // Scrolling is disabled during updateScrollbars (see 2364 // Scrolling is disabled during updateScrollbars (see
2380 // isProgrammaticallyScrollable). Bail now to avoid clearing m_fragmentAnchor 2365 // isProgrammaticallyScrollable). Bail now to avoid clearing m_fragmentAnchor
2381 // before we actually have a chance to scroll. 2366 // before we actually have a chance to scroll.
(...skipping 2875 matching lines...) Expand 10 before | Expand all | Expand 10 after
5257 void FrameView::setAnimationHost( 5242 void FrameView::setAnimationHost(
5258 std::unique_ptr<CompositorAnimationHost> host) { 5243 std::unique_ptr<CompositorAnimationHost> host) {
5259 m_animationHost = std::move(host); 5244 m_animationHost = std::move(host);
5260 } 5245 }
5261 5246
5262 LayoutUnit FrameView::caretWidth() const { 5247 LayoutUnit FrameView::caretWidth() const {
5263 return LayoutUnit(getHostWindow()->windowToViewportScalar(1)); 5248 return LayoutUnit(getHostWindow()->windowToViewportScalar(1));
5264 } 5249 }
5265 5250
5266 } // namespace blink 5251 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698