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

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

Powered by Google App Engine
This is Rietveld 408576698