Changeset 286046 in webkit
- Timestamp:
- Nov 18, 2021, 10:26:43 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 1 added
- 11 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/platform/TextureMapper.cmake (modified) (1 diff)
-
WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp (modified) (3 diffs)
-
WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h (modified) (2 diffs)
-
WebCore/platform/graphics/texmap/TextureMapperLayer.cpp (modified) (7 diffs)
-
WebCore/platform/graphics/texmap/TextureMapperLayer.h (modified) (3 diffs)
-
WebCore/platform/graphics/texmap/TextureMapperSolidColorLayer.h (added)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/GPUProcess/graphics/wc/WCScene.cpp (modified) (1 diff)
-
WebKit/WebProcess/WebPage/wc/GraphicsLayerWC.cpp (modified) (2 diffs)
-
WebKit/WebProcess/WebPage/wc/GraphicsLayerWC.h (modified) (1 diff)
-
WebKit/WebProcess/WebPage/wc/WCUpateInfo.h (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r286044 r286046 1 2021-11-18 Fujii Hironori <Hironori.Fujii@sony.com> 2 3 [TextureMapper][GraphicsLayerTextureMapper][GraphicsLayerWC] setBackgroundColor support 4 https://bugs.webkit.org/show_bug.cgi?id=233244 5 6 Reviewed by Don Olmstead. 7 8 TextureMapper, GraphicsLayerTextureMapper and GraphicsLayerWC 9 didn't support setBackgroundColor. setBackgroundColor is used for 10 "painting flush" feature of Web Inspector Elements tab. 11 12 Added a new class TextureMapperSolidColorLayer to draw a solid 13 layer for the primary layer and contents layer. 14 15 * platform/TextureMapper.cmake: 16 * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp: 17 (WebCore::GraphicsLayerTextureMapper::setBackgroundColor): Added. 18 (WebCore::GraphicsLayerTextureMapper::setContentsToSolidColor): 19 (WebCore::GraphicsLayerTextureMapper::commitLayerChanges): 20 * platform/graphics/texmap/GraphicsLayerTextureMapper.h: 21 * platform/graphics/texmap/TextureMapperLayer.cpp: 22 (WebCore::TextureMapperLayer::paintSelf): 23 (WebCore::TextureMapperLayer::setBackgroundColor): 24 (WebCore::blendWithOpacity): Deleted. 25 * platform/graphics/texmap/TextureMapperLayer.h: 26 * platform/graphics/texmap/TextureMapperSolidColorLayer.h: Added. 27 (WebCore::TextureMapperSolidColorLayer::setColor): 28 1 29 2021-11-18 Ben Nham <nham@apple.com> 2 30 -
trunk/Source/WebCore/platform/TextureMapper.cmake
r284920 r286046 36 36 platform/graphics/texmap/TextureMapperPlatformLayerProxy.h 37 37 platform/graphics/texmap/TextureMapperPlatformLayerProxyProvider.h 38 platform/graphics/texmap/TextureMapperSolidColorLayer.h 38 39 platform/graphics/texmap/TextureMapperTile.h 39 40 platform/graphics/texmap/TextureMapperTiledBackingStore.h -
trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp
r270071 r286046 256 256 } 257 257 258 void GraphicsLayerTextureMapper::setBackgroundColor(const Color& value) 259 { 260 if (value == backgroundColor()) 261 return; 262 GraphicsLayer::setBackgroundColor(value); 263 notifyChange(BackgroundColorChange); 264 } 265 258 266 void GraphicsLayerTextureMapper::setOpacity(float value) 259 267 { … … 287 295 288 296 m_solidColor = color; 289 notifyChange( BackgroundColorChange);297 notifyChange(SolidColorChange); 290 298 } 291 299 … … 476 484 m_layer.setBackfaceVisibility(backfaceVisibility()); 477 485 486 if (m_changeMask & BackgroundColorChange) 487 m_layer.setBackgroundColor(backgroundColor()); 488 478 489 if (m_changeMask & OpacityChange) 479 490 m_layer.setOpacity(opacity()); 480 491 481 if (m_changeMask & BackgroundColorChange)492 if (m_changeMask & SolidColorChange) 482 493 m_layer.setSolidColor(m_solidColor); 483 494 -
trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h
r270071 r286046 60 60 void setContentsOpaque(bool) override; 61 61 void setBackfaceVisibility(bool) override; 62 void setBackgroundColor(const Color&) override; 62 63 void setOpacity(float) override; 63 64 bool setFilters(const FilterOperations&) override; … … 150 151 AnimationStarted = (1L << 26), 151 152 BackdropLayerChange = (1L << 27), 153 SolidColorChange = (1L << 28), 152 154 }; 153 155 void notifyChange(ChangeMask); -
trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp
r284093 r286046 145 145 } 146 146 147 static Color blendWithOpacity(const Color& color, float opacity)148 {149 if (color.isOpaque() && opacity == 1.)150 return color;151 152 return color.colorWithAlphaMultipliedBy(opacity);153 }154 155 147 void TextureMapperLayer::paintSelf(TextureMapperPaintOptions& options) 156 148 { 157 149 if (!m_state.visible || !m_state.contentsVisible) 150 return; 151 auto targetRect = layerRect(); 152 if (targetRect.isEmpty()) 158 153 return; 159 154 … … 164 159 transform.multiply(m_layerTransforms.combined); 165 160 166 if (m_state.solidColor.isValid() && !m_state.contentsRect.isEmpty() && m_state.solidColor.isVisible()) {167 options.textureMapper.drawSolidColor(m_state.contentsRect, transform, blendWithOpacity(m_state.solidColor, options.opacity), true);168 if (m_state.showDebugBorders)169 options.textureMapper.drawBorder(m_state.debugBorderColor, m_state.debugBorderWidth, layerRect(), transform);170 return;161 TextureMapperSolidColorLayer solidColorLayer; 162 TextureMapperBackingStore* backingStore = m_backingStore; 163 if (m_state.backgroundColor.isValid()) { 164 solidColorLayer.setColor(m_state.backgroundColor); 165 backingStore = &solidColorLayer; 171 166 } 172 167 … … 174 169 options.textureMapper.setPatternTransform(TransformationMatrix()); 175 170 176 if (m_backingStore) { 177 FloatRect targetRect = layerRect(); 178 ASSERT(!targetRect.isEmpty()); 179 m_backingStore->paintToTextureMapper(options.textureMapper, targetRect, transform, options.opacity); 171 if (backingStore) { 172 backingStore->paintToTextureMapper(options.textureMapper, targetRect, transform, options.opacity); 180 173 if (m_state.showDebugBorders) 181 m_backingStore->drawBorder(options.textureMapper, m_state.debugBorderColor, m_state.debugBorderWidth, targetRect, transform);174 backingStore->drawBorder(options.textureMapper, m_state.debugBorderColor, m_state.debugBorderWidth, targetRect, transform); 182 175 // Only draw repaint count for the main backing store. 183 176 if (m_state.showRepaintCounter) 184 m_backingStore->drawRepaintCounter(options.textureMapper, m_state.repaintCount, m_state.debugBorderColor, targetRect, transform); 185 } 186 187 if (!m_contentsLayer) 177 backingStore->drawRepaintCounter(options.textureMapper, m_state.repaintCount, m_state.debugBorderColor, targetRect, transform); 178 } 179 180 TextureMapperPlatformLayer* contentsLayer = m_contentsLayer; 181 if (m_state.solidColor.isValid() && m_state.solidColor.isVisible()) { 182 solidColorLayer.setColor(m_state.solidColor); 183 contentsLayer = &solidColorLayer; 184 } 185 if (!contentsLayer) 188 186 return; 189 187 … … 196 194 } 197 195 198 ASSERT(!layerRect().isEmpty());199 200 196 bool shouldClip = m_state.contentsClippingRect.isRounded() || !m_state.contentsClippingRect.rect().contains(m_state.contentsRect); 201 197 if (shouldClip) { … … 203 199 } 204 200 205 m_contentsLayer->paintToTextureMapper(options.textureMapper, m_state.contentsRect, transform, options.opacity);201 contentsLayer->paintToTextureMapper(options.textureMapper, m_state.contentsRect, transform, options.opacity); 206 202 207 203 if (shouldClip) … … 209 205 210 206 if (m_state.showDebugBorders) 211 m_contentsLayer->drawBorder(options.textureMapper, m_state.debugBorderColor, m_state.debugBorderWidth, m_state.contentsRect, transform);207 contentsLayer->drawBorder(options.textureMapper, m_state.debugBorderColor, m_state.debugBorderWidth, m_state.contentsRect, transform); 212 208 } 213 209 … … 680 676 } 681 677 678 void TextureMapperLayer::setBackgroundColor(const Color& color) 679 { 680 m_state.backgroundColor = color; 681 } 682 682 683 void TextureMapperLayer::setFilters(const FilterOperations& filters) 683 684 { -
trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h
r270698 r286046 24 24 #include "NicosiaAnimation.h" 25 25 #include "TextureMapper.h" 26 #include "TextureMapper BackingStore.h"26 #include "TextureMapperSolidColorLayer.h" 27 27 #include <wtf/WeakPtr.h> 28 28 … … 78 78 void setOpacity(float); 79 79 void setSolidColor(const Color&); 80 void setBackgroundColor(const Color&); 80 81 void setContentsTileSize(const FloatSize&); 81 82 void setContentsTilePhase(const FloatSize&); … … 179 180 FloatRoundedRect backdropFiltersRect; 180 181 Color solidColor; 182 Color backgroundColor; 181 183 FilterOperations filters; 182 184 Color debugBorderColor; -
trunk/Source/WebKit/ChangeLog
r286041 r286046 1 2021-11-18 Fujii Hironori <Hironori.Fujii@sony.com> 2 3 [TextureMapper][GraphicsLayerTextureMapper][GraphicsLayerWC] setBackgroundColor support 4 https://bugs.webkit.org/show_bug.cgi?id=233244 5 6 Reviewed by Don Olmstead. 7 8 * GPUProcess/graphics/wc/WCScene.cpp: 9 (WebKit::WCScene::update): 10 * WebProcess/WebPage/wc/GraphicsLayerWC.cpp: 11 (WebKit::GraphicsLayerWC::setBackgroundColor): 12 (WebKit::GraphicsLayerWC::flushCompositingStateForThisLayerOnly): 13 * WebProcess/WebPage/wc/GraphicsLayerWC.h: 14 * WebProcess/WebPage/wc/WCUpateInfo.h: 15 (WebKit::WCLayerUpateInfo::encode const): 16 (WebKit::WCLayerUpateInfo::decode): 17 1 18 2021-11-18 Alex Christensen <achristensen@webkit.org> 2 19 -
trunk/Source/WebKit/GPUProcess/graphics/wc/WCScene.cpp
r285099 r286046 138 138 if (layerUpdate.changes & WCLayerChange::RepaintCount) 139 139 layer->texmapLayer.setRepaintCounter(layerUpdate.showRepaintCounter, layerUpdate.repaintCount); 140 if (layerUpdate.changes & WCLayerChange::BackgroundColor) 141 layer->texmapLayer.setBackgroundColor(layerUpdate.backgroundColor); 140 142 if (layerUpdate.changes & WCLayerChange::Opacity) 141 143 layer->texmapLayer.setOpacity(layerUpdate.opacity); -
trunk/Source/WebKit/WebProcess/WebPage/wc/GraphicsLayerWC.cpp
r285798 r286046 217 217 } 218 218 219 void GraphicsLayerWC::setBackgroundColor(const WebCore::Color& value) 220 { 221 if (value == backgroundColor()) 222 return; 223 GraphicsLayer::setBackgroundColor(value); 224 noteLayerPropertyChanged(WCLayerChange::BackgroundColor); 225 } 226 219 227 void GraphicsLayerWC::setOpacity(float value) 220 228 { … … 447 455 update.repaintCount = repaintCount(); 448 456 } 457 if (update.changes & WCLayerChange::BackgroundColor) 458 update.backgroundColor = backgroundColor(); 449 459 if (update.changes & WCLayerChange::Opacity) 450 460 update.opacity = opacity(); -
trunk/Source/WebKit/WebProcess/WebPage/wc/GraphicsLayerWC.h
r285099 r286046 68 68 void setPreserves3D(bool) override; 69 69 void setMasksToBounds(bool) override; 70 void setBackgroundColor(const WebCore::Color&) override; 70 71 void setOpacity(float) override; 71 72 void setContentsRect(const WebCore::FloatRect&) override; -
trunk/Source/WebKit/WebProcess/WebPage/wc/WCUpateInfo.h
r285099 r286046 56 56 BackdropFilters = 1 << 18, 57 57 PlatformLayer = 1 << 19, 58 BackgroundColor = 1 << 20, 58 59 }; 59 60 … … 75 76 bool preserves3D; 76 77 WebCore::Color solidColor; 78 WebCore::Color backgroundColor; 77 79 WebCore::Color debugBorderColor; 78 80 float opacity; … … 120 122 if (changes & WCLayerChange::ContentsClippingRect) 121 123 encoder << contentsClippingRect; 124 if (changes & WCLayerChange::BackgroundColor) 125 encoder << backgroundColor; 122 126 if (changes & WCLayerChange::Opacity) 123 127 encoder << opacity; … … 205 209 if (result.changes & WCLayerChange::ContentsClippingRect) { 206 210 if (!decoder.decode(result.contentsClippingRect)) 211 return false; 212 } 213 if (result.changes & WCLayerChange::BackgroundColor) { 214 if (!decoder.decode(result.backgroundColor)) 207 215 return false; 208 216 } … … 297 305 WebKit::WCLayerChange::Filters, 298 306 WebKit::WCLayerChange::BackdropFilters, 299 WebKit::WCLayerChange::PlatformLayer 307 WebKit::WCLayerChange::PlatformLayer, 308 WebKit::WCLayerChange::BackgroundColor 300 309 >; 301 310 };
Note:
See TracChangeset
for help on using the changeset viewer.