Changeset 197981 in webkit
- Timestamp:
- Mar 10, 2016, 5:49:22 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 37 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r197980 r197981 1 2016-03-10 Simon Fraser <simon.fraser@apple.com> 2 3 Font antialiasing (smoothing) changes when elements are rendered into compositing layers 4 https://bugs.webkit.org/show_bug.cgi?id=23364 5 6 Reviewed by Tim Horton. 7 8 Improve the appearance of subpixel-antialiased ("smoothed") text in non-opaque layers 9 by opting in to a new CALayer backing store format. 10 11 GraphicsLayer now has setSupportsSmoothedFonts(), which is called by RenderLayerBacking 12 when the platform has support for the new feature. Ideally this would only be set when 13 we know a layer has smoothed text drawn into it, but, for now, enable this for all 14 layers. The right thing happens with opaque layers under the hood. 15 16 setSupportsSmoothedFonts() is turned into a PlatformCALayer contentsFormat flag, which 17 is ultimately passed to setBackingStoreFormat(). 18 19 We also need to propagate this flag to TileController tiles. 20 21 * platform/graphics/GraphicsLayer.cpp: 22 (WebCore::GraphicsLayer::supportsSmoothedLayerText): 23 (WebCore::GraphicsLayer::setSmoothedLayerTextEnabled): 24 (WebCore::GraphicsLayer::smoothedLayerTextEnabled): 25 (WebCore::GraphicsLayer::GraphicsLayer): 26 * platform/graphics/GraphicsLayer.h: 27 (WebCore::GraphicsLayer::supportsSmoothedFonts): 28 (WebCore::GraphicsLayer::setSupportsSmoothedFonts): 29 * platform/graphics/TiledBacking.h: 30 * platform/graphics/ca/GraphicsLayerCA.cpp: 31 (WebCore::GraphicsLayer::supportsSmoothedLayerText): 32 (WebCore::GraphicsLayer::setSmoothedLayerTextEnabled): 33 (WebCore::GraphicsLayer::smoothedLayerTextEnabled): 34 (WebCore::GraphicsLayerCA::setSupportsSmoothedFonts): 35 (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers): 36 (WebCore::GraphicsLayerCA::updateContentsFormat): 37 * platform/graphics/ca/GraphicsLayerCA.h: 38 * platform/graphics/ca/PlatformCALayer.cpp: 39 (WebCore::PlatformCALayer::drawRepaintIndicator): Give the number a "shadow" when 40 the contents format says we support smoothed fonts. 41 * platform/graphics/ca/PlatformCALayer.h: 42 * platform/graphics/ca/TileController.cpp: 43 (WebCore::TileController::setTileContentsFormatFlags): 44 (WebCore::TileController::createTileLayer): 45 * platform/graphics/ca/TileController.h: 46 * platform/graphics/ca/TileGrid.cpp: 47 (WebCore::TileGrid::updateTileLayerProperties): 48 * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h: 49 * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: 50 (WebCore::setBackingStoreFormat): 51 (PlatformCALayerCocoa::commonInit): 52 (PlatformCALayerCocoa::setContentsFormat): 53 (PlatformCALayer::drawLayerContents): Previously, we turned off font smoothing in 54 non-opaque layers to improve text appearance. We no longer need to do that when 55 the contents format has "SmoothedFonts". 56 * platform/graphics/ca/win/PlatformCALayerWin.cpp: 57 (PlatformCALayerWin::setContentsFormat): 58 (PlatformCALayerWin::contentsFormat): 59 * platform/graphics/ca/win/PlatformCALayerWin.h: 60 * platform/ios/LegacyTileGridTile.mm: 61 (WebCore::setBackingStoreFormat): 62 (WebCore::LegacyTileGridTile::LegacyTileGridTile): 63 * rendering/RenderLayerBacking.cpp: 64 (WebCore::RenderLayerBacking::createGraphicsLayer): 65 1 66 2016-03-10 Commit Queue <commit-queue@webkit.org> 2 67 -
trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp
r197941 r197981 106 106 #endif 107 107 108 #if !USE(CA) 109 bool GraphicsLayer::supportsSmoothedLayerText() 110 { 111 return false; 112 } 113 114 void GraphicsLayer::setSmoothedLayerTextEnabled(bool) 115 { 116 } 117 118 bool GraphicsLayer::smoothedLayerTextEnabled() 119 { 120 return false; 121 } 122 #endif 123 108 124 GraphicsLayer::GraphicsLayer(Type type, GraphicsLayerClient& client) 109 125 : m_client(client) … … 116 132 , m_type(type) 117 133 , m_contentsOpaque(false) 134 , m_supportsSmoothedFonts(false) 118 135 , m_preserves3D(false) 119 136 , m_backfaceVisibility(true) -
trunk/Source/WebCore/platform/graphics/GraphicsLayer.h
r197941 r197981 365 365 virtual void setContentsOpaque(bool b) { m_contentsOpaque = b; } 366 366 367 bool supportsSmoothedFonts() const { return m_supportsSmoothedFonts; } 368 virtual void setSupportsSmoothedFonts(bool b) { m_supportsSmoothedFonts = b; } 369 367 370 bool backfaceVisibility() const { return m_backfaceVisibility; } 368 371 virtual void setBackfaceVisibility(bool b) { m_backfaceVisibility = b; } … … 541 544 static bool supportsLayerType(Type); 542 545 static bool supportsContentsTiling(); 546 static bool supportsSmoothedLayerText(); 547 548 WEBCORE_EXPORT static void setSmoothedLayerTextEnabled(bool); 549 WEBCORE_EXPORT static bool smoothedLayerTextEnabled(); 543 550 544 551 void updateDebugIndicators(); … … 614 621 615 622 bool m_contentsOpaque : 1; 623 bool m_supportsSmoothedFonts : 1; 616 624 bool m_preserves3D: 1; 617 625 bool m_backfaceVisibility : 1; -
trunk/Source/WebCore/platform/graphics/TiledBacking.h
r197941 r197981 80 80 virtual void setTopContentInset(float) = 0; 81 81 82 virtual void setTileContentsFormatFlags(unsigned) = 0; 83 82 84 virtual void setVelocity(const VelocityData&) = 0; 83 85 -
trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
r197941 r197981 310 310 } 311 311 312 static bool isSmoothedLayerTextEnabled = true; 313 314 bool GraphicsLayer::supportsSmoothedLayerText() 315 { 316 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200 317 return isSmoothedLayerTextEnabled; 318 #endif 319 return false; 320 } 321 322 void GraphicsLayer::setSmoothedLayerTextEnabled(bool flag) 323 { 324 isSmoothedLayerTextEnabled = flag; 325 } 326 327 bool GraphicsLayer::smoothedLayerTextEnabled() 328 { 329 return isSmoothedLayerTextEnabled; 330 } 331 312 332 std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient& client, Type layerType) 313 333 { … … 708 728 GraphicsLayer::setContentsOpaque(opaque); 709 729 noteLayerPropertyChanged(ContentsOpaqueChanged); 730 } 731 732 void GraphicsLayerCA::setSupportsSmoothedFonts(bool supportsSmoothedFonts) 733 { 734 if (m_supportsSmoothedFonts == supportsSmoothedFonts) 735 return; 736 737 GraphicsLayer::setSupportsSmoothedFonts(supportsSmoothedFonts); 738 noteLayerPropertyChanged(ContentsFormatChanged); 710 739 } 711 740 … … 1581 1610 updateContentsOpaque(pageScaleFactor); 1582 1611 1612 if (m_uncommittedChanges & ContentsFormatChanged) 1613 updateContentsFormat(); 1614 1583 1615 if (m_uncommittedChanges & BackfaceVisibilityChanged) 1584 1616 updateBackfaceVisibility(); … … 1888 1920 for (auto& layer : layerCloneMap->values()) 1889 1921 layer->setOpaque(contentsOpaque); 1922 } 1923 } 1924 1925 void GraphicsLayerCA::updateContentsFormat() 1926 { 1927 PlatformCALayer::ContentsFormatFlags formatFlags = 0; 1928 if (supportsSmoothedFonts()) 1929 formatFlags |= PlatformCALayer::SmoothedFonts; 1930 1931 m_layer->setContentsFormat(formatFlags); 1932 1933 if (LayerMap* layerCloneMap = m_layerClones.get()) { 1934 for (auto& layer : layerCloneMap->values()) 1935 layer->setContentsFormat(formatFlags); 1890 1936 } 1891 1937 } -
trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h
r197941 r197981 96 96 97 97 WEBCORE_EXPORT void setContentsOpaque(bool) override; 98 WEBCORE_EXPORT void setSupportsSmoothedFonts(bool) override; 99 98 100 WEBCORE_EXPORT void setBackfaceVisibility(bool) override; 99 101 … … 392 394 void updateContentsVisibility(); 393 395 void updateContentsOpaque(float pageScaleFactor); 396 void updateContentsFormat(); 394 397 void updateBackfaceVisibility(); 395 398 void updateStructuralLayer(); … … 456 459 457 460 enum LayerChange : uint64_t { 458 NoChange = 0, 459 NameChanged = 1LLU << 1, 460 ChildrenChanged = 1LLU << 2, // also used for content layer, and preserves-3d, and size if tiling changes? 461 GeometryChanged = 1LLU << 3, 462 TransformChanged = 1LLU << 4, 463 ChildrenTransformChanged = 1LLU << 5, 464 Preserves3DChanged = 1LLU << 6, 465 MasksToBoundsChanged = 1LLU << 7, 466 DrawsContentChanged = 1LLU << 8, 467 BackgroundColorChanged = 1LLU << 9, 468 ContentsOpaqueChanged = 1LLU << 10, 469 BackfaceVisibilityChanged = 1LLU << 11, 470 OpacityChanged = 1LLU << 12, 471 AnimationChanged = 1LLU << 13, 472 DirtyRectsChanged = 1LLU << 14, 473 ContentsImageChanged = 1LLU << 15, 474 ContentsPlatformLayerChanged = 1LLU << 16, 475 ContentsColorLayerChanged = 1LLU << 17, 476 ContentsRectsChanged = 1LLU << 18, 477 MasksToBoundsRectChanged = 1LLU << 19, 478 MaskLayerChanged = 1LLU << 20, 479 ReplicatedLayerChanged = 1LLU << 21, 480 ContentsNeedsDisplay = 1LLU << 22, 481 AcceleratesDrawingChanged = 1LLU << 23, 482 ContentsScaleChanged = 1LLU << 24, 483 ContentsVisibilityChanged = 1LLU << 25, 484 CoverageRectChanged = 1LLU << 26, 485 FiltersChanged = 1LLU << 27, 486 BackdropFiltersChanged = 1LLU << 28, 487 BackdropFiltersRectChanged = 1LLU << 29, 488 TilingAreaChanged = 1LLU << 30, 489 TilesAdded = 1LLU << 31, 490 DebugIndicatorsChanged = 1LLU << 32, 491 CustomAppearanceChanged = 1LLU << 33, 492 BlendModeChanged = 1LLU << 34, 493 ShapeChanged = 1LLU << 35, 494 WindRuleChanged = 1LLU << 36, 461 NoChange = 0, 462 NameChanged = 1LLU << 1, 463 ChildrenChanged = 1LLU << 2, // also used for content layer, and preserves-3d, and size if tiling changes? 464 GeometryChanged = 1LLU << 3, 465 TransformChanged = 1LLU << 4, 466 ChildrenTransformChanged = 1LLU << 5, 467 Preserves3DChanged = 1LLU << 6, 468 MasksToBoundsChanged = 1LLU << 7, 469 DrawsContentChanged = 1LLU << 8, 470 BackgroundColorChanged = 1LLU << 9, 471 ContentsOpaqueChanged = 1LLU << 10, 472 ContentsFormatChanged = 1LLU << 11, 473 BackfaceVisibilityChanged = 1LLU << 12, 474 OpacityChanged = 1LLU << 13, 475 AnimationChanged = 1LLU << 14, 476 DirtyRectsChanged = 1LLU << 15, 477 ContentsImageChanged = 1LLU << 16, 478 ContentsPlatformLayerChanged = 1LLU << 17, 479 ContentsColorLayerChanged = 1LLU << 18, 480 ContentsRectsChanged = 1LLU << 19, 481 MasksToBoundsRectChanged = 1LLU << 20, 482 MaskLayerChanged = 1LLU << 21, 483 ReplicatedLayerChanged = 1LLU << 22, 484 ContentsNeedsDisplay = 1LLU << 23, 485 AcceleratesDrawingChanged = 1LLU << 24, 486 ContentsScaleChanged = 1LLU << 25, 487 ContentsVisibilityChanged = 1LLU << 26, 488 CoverageRectChanged = 1LLU << 27, 489 FiltersChanged = 1LLU << 28, 490 BackdropFiltersChanged = 1LLU << 29, 491 BackdropFiltersRectChanged = 1LLU << 30, 492 TilingAreaChanged = 1LLU << 31, 493 TilesAdded = 1LLU << 32, 494 DebugIndicatorsChanged = 1LLU << 33, 495 CustomAppearanceChanged = 1LLU << 34, 496 BlendModeChanged = 1LLU << 35, 497 ShapeChanged = 1LLU << 36, 498 WindRuleChanged = 1LLU << 37, 495 499 }; 496 500 typedef uint64_t LayerChangeFlags; -
trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp
r197941 r197981 81 81 82 82 CGContextFillRect(context, indicatorBox); 83 83 84 if (platformCALayer->owner()->isUsingDisplayListDrawing(platformCALayer)) { 85 CGContextSetRGBStrokeColor(context, 0, 0, 0, 0.65); 86 CGContextSetLineWidth(context, 2); 87 CGContextStrokeRect(context, indicatorBox); 88 } 89 90 if (!platformCALayer->isOpaque() && (platformCALayer->contentsFormat() & SmoothedFonts)) { 91 CGContextSetRGBFillColor(context, 1, 1, 1, 0.4); 92 platformCALayer->drawTextAtPoint(context, indicatorBox.origin.x + 7, indicatorBox.origin.y + 24, CGSizeMake(1, -1), 22, text, strlen(text)); 93 } 94 84 95 if (platformCALayer->acceleratesDrawing()) 85 96 CGContextSetRGBFillColor(context, 1, 0, 0, 1); 86 97 else 87 98 CGContextSetRGBFillColor(context, 1, 1, 1, 1); 88 89 if (platformCALayer->owner()->isUsingDisplayListDrawing(platformCALayer)) {90 CGContextSetRGBStrokeColor(context, 0, 0, 0, 0.65);91 CGContextSetLineWidth(context, 2);92 CGContextStrokeRect(context, indicatorBox);93 }94 99 95 100 platformCALayer->drawTextAtPoint(context, indicatorBox.origin.x + 5, indicatorBox.origin.y + 22, CGSizeMake(1, -1), 22, text, strlen(text)); -
trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h
r197941 r197981 140 140 virtual void setOpaque(bool) = 0; 141 141 142 enum ContentsFormatFlag { 143 DeepColor = 1 << 0, 144 SmoothedFonts = 1 << 1, 145 }; 146 typedef unsigned ContentsFormatFlags; 147 virtual void setContentsFormat(ContentsFormatFlags) = 0; 148 virtual ContentsFormatFlags contentsFormat() const = 0; 149 142 150 virtual FloatRect bounds() const = 0; 143 151 virtual void setBounds(const FloatRect&) = 0; -
trunk/Source/WebCore/platform/graphics/ca/TileController.cpp
r197941 r197981 176 176 } 177 177 178 void TileController::setTileContentsFormatFlags(PlatformCALayer::ContentsFormatFlags flags) 179 { 180 if (flags == m_contentsFormatFlags) 181 return; 182 183 m_contentsFormatFlags = flags; 184 tileGrid().updateTileLayerProperties(); 185 } 186 178 187 void TileController::setVisibleRect(const FloatRect& rect) 179 188 { … … 676 685 layer->setEdgeAntialiasingMask(0); 677 686 layer->setOpaque(m_tilesAreOpaque); 687 layer->setContentsFormat(m_contentsFormatFlags); 678 688 #ifndef NDEBUG 679 689 layer->setName("Tile"); -
trunk/Source/WebCore/platform/graphics/ca/TileController.h
r197941 r197981 78 78 WEBCORE_EXPORT void setTilesOpaque(bool); 79 79 bool tilesAreOpaque() const { return m_tilesAreOpaque; } 80 81 void setTileContentsFormatFlags(PlatformCALayer::ContentsFormatFlags) override; 82 PlatformCALayer::ContentsFormatFlags tileContentsFormatFlags() const { return m_contentsFormatFlags; } 80 83 81 84 PlatformCALayer& rootLayer() { return *m_tileCacheLayer; } … … 207 210 int m_marginSize { kDefaultTileSize }; 208 211 212 PlatformCALayer::ContentsFormatFlags m_contentsFormatFlags { 0 }; 213 209 214 // m_marginTop and m_marginBottom are the height in pixels of the top and bottom margin tiles. The width 210 215 // of those tiles will be equivalent to the width of the other tiles in the grid. m_marginRight and -
trunk/Source/WebCore/platform/graphics/ca/TileGrid.cpp
r197941 r197981 176 176 bool acceleratesDrawing = m_controller.acceleratesDrawing(); 177 177 bool opaque = m_controller.tilesAreOpaque(); 178 PlatformCALayer::ContentsFormatFlags formatFlags = m_controller.tileContentsFormatFlags(); 178 179 Color tileDebugBorderColor = m_controller.tileDebugBorderColor(); 179 180 float tileDebugBorderWidth = m_controller.tileDebugBorderWidth(); … … 183 184 tileInfo.layer->setAcceleratesDrawing(acceleratesDrawing); 184 185 tileInfo.layer->setOpaque(opaque); 186 tileInfo.layer->setContentsFormat(formatFlags); 185 187 tileInfo.layer->setBorderColor(tileDebugBorderColor); 186 188 tileInfo.layer->setBorderWidth(tileDebugBorderWidth); -
trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h
r197941 r197981 72 72 bool isOpaque() const override; 73 73 void setOpaque(bool) override; 74 75 void setContentsFormat(ContentsFormatFlags) override; 76 ContentsFormatFlags contentsFormat() const override { return m_contentsFormatFlags; } 74 77 75 78 FloatRect bounds() const override; … … 180 183 GraphicsLayer::CustomAppearance m_customAppearance; 181 184 std::unique_ptr<FloatRoundedRect> m_shapeRoundedRect; 185 ContentsFormatFlags m_contentsFormatFlags { 0 }; 182 186 }; 183 187 -
trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm
r197941 r197981 70 70 #else 71 71 namespace WebCore { 72 static void setBackingStoreFormat(CALayer * )72 static void setBackingStoreFormat(CALayer *, PlatformCALayer::ContentsFormatFlags) 73 73 { 74 74 } … … 309 309 310 310 if (m_layerType == LayerTypeWebLayer || m_layerType == LayerTypeTiledBackingTileLayer) 311 setBackingStoreFormat(m_layer.get() );311 setBackingStoreFormat(m_layer.get(), 0); 312 312 313 313 // So that the scrolling thread's performance logging code can find all the tiles, mark this as being a tile. … … 546 546 } 547 547 548 void PlatformCALayerCocoa::setContentsFormat(ContentsFormatFlags flags) 549 { 550 if (flags == m_contentsFormatFlags) 551 return; 552 553 m_contentsFormatFlags = flags; 554 555 if (usesTiledBackingLayer()) { 556 WebTiledBackingLayer* tiledBackingLayer = static_cast<WebTiledBackingLayer*>(m_layer.get()); 557 tiledBackingLayer.tiledBacking->setTileContentsFormatFlags(flags); 558 return; 559 } 560 561 setBackingStoreFormat(m_layer.get(), flags); 562 } 563 548 564 FloatRect PlatformCALayerCocoa::bounds() const 549 565 { … … 1057 1073 graphicsContext.setIsAcceleratedContext(platformCALayer->acceleratesDrawing()); 1058 1074 1059 if (!layerContents->platformCALayerContentsOpaque() ) {1075 if (!layerContents->platformCALayerContentsOpaque() && !(platformCALayer->contentsFormat() & SmoothedFonts)) { 1060 1076 // Turn off font smoothing to improve the appearance of text rendered onto a transparent background. 1061 1077 graphicsContext.setShouldSmoothFonts(false); -
trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp
r197941 r197981 378 378 } 379 379 380 void PlatformCALayerWin::setContentsFormat(ContentsFormatFlags formatFlags) 381 { 382 m_contentsFormat = formatFlags; 383 } 384 385 PlatformCALayer::ContentsFormatFlags PlatformCALayerWin::contentsFormat() const 386 { 387 return m_contentsFormat; 388 } 389 380 390 FloatRect PlatformCALayerWin::bounds() const 381 391 { -
trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h
r197941 r197981 64 64 bool isOpaque() const override; 65 65 void setOpaque(bool) override; 66 67 void setContentsFormat(ContentsFormatFlags) override; 68 ContentsFormatFlags contentsFormat() const override; 66 69 67 70 FloatRect bounds() const override; … … 164 167 std::unique_ptr<PlatformCALayerList> m_customSublayers; 165 168 GraphicsLayer::CustomAppearance m_customAppearance; 169 ContentsFormatFlags m_contentsFormat { 0 }; 166 170 }; 167 171 -
trunk/Source/WebCore/platform/ios/LegacyTileGridTile.mm
r197941 r197981 29 29 #if PLATFORM(IOS) 30 30 31 #include "BlockExceptions.h" 31 32 #include "Color.h" 32 33 #include "LegacyTileCache.h" … … 34 35 #include "LegacyTileLayer.h" 35 36 #include "LegacyTileLayerPool.h" 37 #include "PlatformCALayer.h" 36 38 #include "QuartzCoreSPI.h" 37 39 #include "WAKWindow.h" … … 44 46 #else 45 47 namespace WebCore { 46 static void setBackingStoreFormat(CALayer * )48 static void setBackingStoreFormat(CALayer *, PlatformCALayer::ContentsFormatFlags) 47 49 { 48 50 } … … 72 74 } 73 75 LegacyTileLayer* layer = m_tileLayer.get(); 74 setBackingStoreFormat(layer );76 setBackingStoreFormat(layer, 0); 75 77 [layer setTileGrid:tileGrid]; 76 78 [layer setOpaque:m_tileGrid->tileCache().tilesOpaque()]; -
trunk/Source/WebCore/rendering/RenderLayerBacking.cpp
r197941 r197981 179 179 graphicsLayer->setUsesDisplayListDrawing(compositor().displayListDrawingEnabled()); 180 180 #endif 181 182 // FIXME: ideally we'd only do this if the layer contains smoothed text. 183 if (GraphicsLayer::supportsSmoothedLayerText()) 184 graphicsLayer->setSupportsSmoothedFonts(true); 181 185 182 186 return graphicsLayer; -
trunk/Source/WebKit/mac/ChangeLog
r197968 r197981 1 2016-03-10 Simon Fraser <simon.fraser@apple.com> 2 3 Font antialiasing (smoothing) changes when elements are rendered into compositing layers 4 https://bugs.webkit.org/show_bug.cgi?id=23364 5 6 Reviewed by Tim Horton. 7 8 Allow internal clients to turn off smoothed layer text, so that WebKitTestRunner 9 can disable it. 10 11 * WebView/WebView.mm: 12 (+[WebView _setSmoothedLayerTextEnabled:]): 13 (+[WebView _smoothedLayerTextEnabled]): 14 * WebView/WebViewPrivate.h: 15 1 16 2016-03-10 Jer Noble <jer.noble@apple.com> 2 17 -
trunk/Source/WebKit/mac/WebView/WebView.mm
r197968 r197981 141 141 #import <WebCore/GeolocationController.h> 142 142 #import <WebCore/GeolocationError.h> 143 #import <WebCore/GraphicsLayer.h> 143 144 #import <WebCore/HTMLNames.h> 144 145 #import <WebCore/HTMLVideoElement.h> … … 3237 3238 } 3238 3239 3240 + (void)_setSmoothedLayerTextEnabled:(BOOL)f 3241 { 3242 GraphicsLayer::setSmoothedLayerTextEnabled(f); 3243 } 3244 3245 + (BOOL)_smoothedLayerTextEnabled 3246 { 3247 return GraphicsLayer::smoothedLayerTextEnabled(); 3248 } 3249 3239 3250 #if !PLATFORM(IOS) 3240 3251 + (void)_setUsesTestModeFocusRingColor:(BOOL)f -
trunk/Source/WebKit/mac/WebView/WebViewPrivate.h
r196024 r197981 533 533 + (BOOL)_shouldUseFontSmoothing; 534 534 535 + (void)_setSmoothedLayerTextEnabled:(BOOL)f; 536 + (BOOL)_smoothedLayerTextEnabled; 537 535 538 #if !TARGET_OS_IPHONE 536 539 // These two methods are useful for a test harness that needs a consistent appearance for the focus rings -
trunk/Source/WebKit2/ChangeLog
r197976 r197981 1 2016-03-10 Simon Fraser <simon.fraser@apple.com> 2 3 Font antialiasing (smoothing) changes when elements are rendered into compositing layers 4 https://bugs.webkit.org/show_bug.cgi?id=23364 5 6 Reviewed by Tim Horton. 7 8 Send the ContentsFormat to the UI process (but nothing happens to it there yet). 9 10 Allow internal clients to turn off smoothed layer text, so that WebKitTestRunner 11 can disable it. 12 13 * Shared/WebProcessCreationParameters.cpp: 14 (WebKit::WebProcessCreationParameters::WebProcessCreationParameters): 15 (WebKit::WebProcessCreationParameters::encode): 16 (WebKit::WebProcessCreationParameters::decode): 17 * Shared/WebProcessCreationParameters.h: 18 * Shared/mac/RemoteLayerTreeTransaction.h: 19 * Shared/mac/RemoteLayerTreeTransaction.mm: 20 (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode): 21 (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode): 22 * UIProcess/API/C/WKContext.cpp: 23 (WKContextEnableSmoothedLayerText): 24 * UIProcess/API/C/WKContextPrivate.h: 25 * UIProcess/WebProcessPool.cpp: 26 (WebKit::WebProcessPool::createNewWebProcess): 27 (WebKit::WebProcessPool::enableSmoothedLayerText): 28 (WebKit::WebProcessPool::WebProcessPool): Deleted. 29 * UIProcess/WebProcessPool.h: 30 * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp: 31 (WebKit::PlatformCALayerRemote::setContentsFormat): 32 (WebKit::PlatformCALayerRemote::contentsFormat): 33 * WebProcess/WebPage/mac/PlatformCALayerRemote.h: 34 * WebProcess/WebProcess.cpp: 35 (WebKit::WebProcess::initializeWebProcess): 36 (WebKit::WebProcess::enableSmoothedLayerText): 37 * WebProcess/WebProcess.h: 38 * WebProcess/WebProcess.messages.in: 39 1 40 2016-03-10 Enrica Casucci <enrica@apple.com> 2 41 -
trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp
r197592 r197981 36 36 37 37 WebProcessCreationParameters::WebProcessCreationParameters() 38 : shouldAlwaysUseComplexTextCodePath(false) 39 , shouldEnableMemoryPressureReliefLogging(false) 40 , shouldUseFontSmoothing(true) 41 , defaultRequestTimeoutInterval(INT_MAX) 42 #if PLATFORM(COCOA) 43 , shouldEnableJIT(false) 44 , shouldEnableFTLJIT(false) 45 #endif 46 , memoryCacheDisabled(false) 47 #if ENABLE(SERVICE_CONTROLS) 48 , hasImageServices(false) 49 , hasSelectionServices(false) 50 , hasRichContentServices(false) 51 #endif 38 : defaultRequestTimeoutInterval(INT_MAX) 52 39 { 53 40 } … … 97 84 encoder << shouldSuppressMemoryPressureHandler; 98 85 encoder << shouldUseFontSmoothing; 86 encoder << enabledSmoothedLayerText; 99 87 encoder << resourceLoadStatisticsEnabled; 100 88 encoder << fontWhitelist; … … 215 203 if (!decoder.decode(parameters.shouldUseFontSmoothing)) 216 204 return false; 205 if (!decoder.decode(parameters.enabledSmoothedLayerText)) 206 return false; 217 207 if (!decoder.decode(parameters.resourceLoadStatisticsEnabled)) 218 208 return false; -
trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h
r197592 r197981 104 104 CacheModel cacheModel; 105 105 106 bool shouldAlwaysUseComplexTextCodePath ;107 bool shouldEnableMemoryPressureReliefLogging ;106 bool shouldAlwaysUseComplexTextCodePath { false }; 107 bool shouldEnableMemoryPressureReliefLogging { false }; 108 108 bool shouldSuppressMemoryPressureHandler { false }; 109 bool shouldUseFontSmoothing; 109 bool shouldUseFontSmoothing { true }; 110 bool enabledSmoothedLayerText { true }; 110 111 bool resourceLoadStatisticsEnabled { false }; 111 112 … … 139 140 SandboxExtension::Handle uiProcessBundleResourcePathExtensionHandle; 140 141 141 bool shouldEnableJIT ;142 bool shouldEnableFTLJIT ;142 bool shouldEnableJIT { false }; 143 bool shouldEnableFTLJIT { false }; 143 144 144 145 RefPtr<API::Data> bundleParameterData; … … 153 154 Vector<String> plugInAutoStartOrigins; 154 155 155 bool memoryCacheDisabled ;156 bool memoryCacheDisabled { false }; 156 157 157 158 #if ENABLE(SERVICE_CONTROLS) 158 bool hasImageServices ;159 bool hasSelectionServices ;160 bool hasRichContentServices ;159 bool hasImageServices { false }; 160 bool hasSelectionServices { false }; 161 bool hasRichContentServices { false }; 161 162 #endif 162 163 -
trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h
r197941 r197981 88 88 AnimationsChanged = 1LLU << 33, 89 89 EdgeAntialiasingMaskChanged = 1LLU << 34, 90 CustomAppearanceChanged = 1LLU << 35, 90 ContentsFormatFlagsChanged = 1LLU << 35, 91 CustomAppearanceChanged = 1LLU << 36, 91 92 }; 92 93 typedef uint64_t LayerChange; … … 154 155 WebCore::Color borderColor; 155 156 unsigned edgeAntialiasingMask; 157 WebCore::PlatformCALayer::ContentsFormatFlags contentsFormatFlags; 156 158 WebCore::GraphicsLayer::CustomAppearance customAppearance; 157 159 WebCore::PlatformCALayer::FilterType minificationFilter; -
trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm
r197941 r197981 212 212 encoder << opaque; 213 213 214 if (changedProperties & ContentsFormatFlagsChanged) 215 encoder << contentsFormatFlags; 216 214 217 if (changedProperties & MaskLayerChanged) 215 218 encoder << maskLayerID; … … 372 375 if (result.changedProperties & OpaqueChanged) { 373 376 if (!decoder.decode(result.opaque)) 377 return false; 378 } 379 380 if (result.changedProperties & ContentsFormatFlagsChanged) { 381 if (!decoder.decode(result.contentsFormatFlags)) 374 382 return false; 375 383 } -
trunk/Source/WebKit2/UIProcess/API/C/WKContext.cpp
r197563 r197981 348 348 } 349 349 350 void WKContextEnableSmoothedLayerText(WKContextRef contextRef, bool smoothedLayerText) 351 { 352 toImpl(contextRef)->enableSmoothedLayerText(smoothedLayerText); 353 } 354 350 355 void WKContextSetAdditionalPluginsDirectory(WKContextRef contextRef, WKStringRef pluginsDirectory) 351 356 { -
trunk/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h
r195589 r197981 51 51 WK_EXPORT void WKContextSetShouldUseFontSmoothing(WKContextRef context, bool useFontSmoothing); 52 52 53 WK_EXPORT void WKContextEnableSmoothedLayerText(WKContextRef context, bool); 54 53 55 WK_EXPORT void WKContextRegisterURLSchemeAsSecure(WKContextRef context, WKStringRef urlScheme); 54 56 -
trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp
r197914 r197981 149 149 , m_visitedLinksPopulated(false) 150 150 , m_plugInAutoStartProvider(this) 151 , m_alwaysUsesComplexTextCodePath(false)152 , m_shouldUseFontSmoothing(true)153 151 , m_memorySamplerEnabled(false) 154 152 , m_memorySamplerInterval(1400.0) … … 587 585 parameters.shouldAlwaysUseComplexTextCodePath = m_alwaysUsesComplexTextCodePath; 588 586 parameters.shouldUseFontSmoothing = m_shouldUseFontSmoothing; 587 parameters.enabledSmoothedLayerText = m_enabledSmoothedLayerText; 589 588 590 589 // FIXME: This leaves UI process and WebProcess disagreeing about the state if the client hasn't set the path. … … 873 872 } 874 873 874 void WebProcessPool::enableSmoothedLayerText(bool enableSmoothedText) 875 { 876 m_enabledSmoothedLayerText = enableSmoothedText; 877 sendToAllProcesses(Messages::WebProcess::EnableSmoothedLayerText(enableSmoothedText)); 878 } 879 875 880 void WebProcessPool::registerURLSchemeAsEmptyDocument(const String& urlScheme) 876 881 { -
trunk/Source/WebKit2/UIProcess/WebProcessPool.h
r197914 r197981 192 192 void setAlwaysUsesComplexTextCodePath(bool); 193 193 void setShouldUseFontSmoothing(bool); 194 void enableSmoothedLayerText(bool); 194 195 195 196 void registerURLSchemeAsEmptyDocument(const String&); … … 464 465 #endif 465 466 466 bool m_alwaysUsesComplexTextCodePath; 467 bool m_shouldUseFontSmoothing; 467 bool m_alwaysUsesComplexTextCodePath { false }; 468 bool m_shouldUseFontSmoothing { true }; 469 bool m_enabledSmoothedLayerText { true }; 468 470 469 471 Vector<String> m_fontWhitelist; -
trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp
r197941 r197981 402 402 } 403 403 404 void PlatformCALayerRemote::setContentsFormat(ContentsFormatFlags formatFlags) 405 { 406 if (formatFlags == m_properties.contentsFormatFlags) 407 return; 408 409 m_properties.contentsFormatFlags = formatFlags; 410 m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ContentsFormatFlagsChanged); 411 } 412 413 PlatformCALayer::ContentsFormatFlags PlatformCALayerRemote::contentsFormat() const 414 { 415 return m_properties.contentsFormatFlags; 416 } 417 404 418 void PlatformCALayerRemote::setClonedLayer(const PlatformCALayer* layer) 405 419 { -
trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h
r197941 r197981 77 77 void setOpaque(bool) override; 78 78 79 void setContentsFormat(ContentsFormatFlags) override; 80 ContentsFormatFlags contentsFormat() const override; 81 79 82 WebCore::FloatRect bounds() const override; 80 83 void setBounds(const WebCore::FloatRect&) override; -
trunk/Source/WebKit2/WebProcess/WebProcess.cpp
r197592 r197981 77 77 #include <WebCore/GCController.h> 78 78 #include <WebCore/GlyphPage.h> 79 #include <WebCore/GraphicsLayer.h> 79 80 #include <WebCore/IconDatabase.h> 80 81 #include <WebCore/JSDOMWindow.h> … … 344 345 setShouldUseFontSmoothing(true); 345 346 347 enableSmoothedLayerText(parameters.enabledSmoothedLayerText); 348 346 349 #if PLATFORM(COCOA) || USE(CFNETWORK) 347 350 setApplicationBundleIdentifier(parameters.uiProcessBundleIdentifier); … … 475 478 { 476 479 WebCore::FontCascade::setShouldUseSmoothing(useFontSmoothing); 480 } 481 482 void WebProcess::enableSmoothedLayerText(bool smoothedLayerText) 483 { 484 WebCore::GraphicsLayer::setSmoothedLayerTextEnabled(smoothedLayerText); 477 485 } 478 486 -
trunk/Source/WebKit2/WebProcess/WebProcess.h
r197901 r197981 239 239 void setAlwaysUsesComplexTextCodePath(bool); 240 240 void setShouldUseFontSmoothing(bool); 241 void enableSmoothedLayerText(bool); 242 241 243 void setResourceLoadStatisticsEnabled(bool); 242 244 void userPreferredLanguagesChanged(const Vector<String>&) const; -
trunk/Source/WebKit2/WebProcess/WebProcess.messages.in
r197592 r197981 43 43 SetAlwaysUsesComplexTextCodePath(bool alwaysUseComplexText) 44 44 SetShouldUseFontSmoothing(bool useFontSmoothing) 45 EnableSmoothedLayerText(bool smoothedLayerText) 45 46 SetResourceLoadStatisticsEnabled(bool resourceLoadStatisticsEnabled); 46 47 UserPreferredLanguagesChanged(Vector<String> languages) -
trunk/Tools/ChangeLog
r197964 r197981 1 2016-03-10 Simon Fraser <simon.fraser@apple.com> 2 3 Font antialiasing (smoothing) changes when elements are rendered into compositing layers 4 https://bugs.webkit.org/show_bug.cgi?id=23364 5 6 Reviewed by Tim Horton. 7 8 Turn off smoothed layer text because it affects many layout test results. 9 10 * DumpRenderTree/mac/DumpRenderTree.mm: 11 (resetWebViewToConsistentStateBeforeTesting): 12 * WebKitTestRunner/TestController.cpp: 13 (WTR::TestController::resetStateToConsistentValues): 14 1 15 2016-03-10 Jer Noble <jer.noble@apple.com> 2 16 -
trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm
r197953 r197981 1848 1848 #endif 1849 1849 [webView setTracksRepaints:NO]; 1850 [WebView _setSmoothedLayerTextEnabled:NO]; 1850 1851 1851 1852 [WebCache clearCachedCredentials]; -
trunk/Tools/WebKitTestRunner/TestController.cpp
r197956 r197981 718 718 719 719 WKContextSetShouldUseFontSmoothing(TestController::singleton().context(), false); 720 WKContextEnableSmoothedLayerText(TestController::singleton().context(), false); 720 721 721 722 WKContextSetCacheModel(TestController::singleton().context(), kWKCacheModelDocumentBrowser);
Note:
See TracChangeset
for help on using the changeset viewer.