haikuwebkit/LayoutTests/css3/color/box-shadows-expected.html

34 lines
1.1 KiB
HTML
Raw Permalink Normal View History

Rendering support for ExtendedColors https://bugs.webkit.org/show_bug.cgi?id=164443 <rdar://problems/29123243> Reviewed by Simon Fraser and Darin Adler. Source/WebCore: Add support for rendering the new color() syntax, which ends up as an ExtendedColor. In order to make rendering code a little more readable, I changed Color::hasAlpha to Color::isOpaque (since an alpha of 100% is still an alpha), and added a Color::isVisible helper (the color isn't completely transparent). These new helpers support ExtendedColor forms. Support for painting gradients and blending between colors is still to come. I also added some FIXME comments to show other places that don't handle ExtendedColors yet. Tests: css3/color/backgrounds-and-borders.html css3/color/box-shadows.html css3/color/canvas.html css3/color/composited-solid-backgrounds.html css3/color/text.html * css/CSSGradientValue.cpp: Add some notes that this is broken. (WebCore::interpolate): (WebCore::CSSGradientValue::knownToBeOpaque): * editing/EditingStyle.cpp: Use new Color helpers. (WebCore::isTransparentColorValue): * editing/mac/EditorMac.mm: Use new Color helpers. (WebCore::Editor::fontAttributesForSelectionStart): * html/ColorInputType.cpp: No need to use the Color class at all here. (WebCore::isValidSimpleColorString): Renamed from isValidColorString. (WebCore::ColorInputType::sanitizeValue): (WebCore::ColorInputType::typeMismatchFor): (WebCore::isValidColorString): Deleted. * html/canvas/CanvasRenderingContext2D.cpp: New helpers. (WebCore::CanvasRenderingContext2D::shouldDrawShadows): (WebCore::CanvasRenderingContext2D::didDraw): * page/FrameView.cpp: Ditto. (WebCore::FrameView::recalculateScrollbarOverlayStyle): (WebCore::FrameView::hasOpaqueBackground): (WebCore::FrameView::setBaseBackgroundColor): * platform/graphics/Color.cpp: (WebCore::differenceSquared): Support ExtendedColor, but also add a note to indicate that this method and its call sites should use floats. (WebCore::Color::serialized): New helper. (WebCore::Color::cssText): Ditto. (WebCore::Color::blend): Ditto. (WebCore::Color::blendWithWhite): (WebCore::Color::colorWithAlphaMultipliedBy): Implementation of new function. (WebCore::Color::colorWithAlpha): Ditto. (WebCore::Color::opaqueColor): New method to return an opaque version of the given color. (WebCore::blend): * platform/graphics/Color.h: (WebCore::Color::isOpaque): New helper that is !hasAlpha(). (WebCore::Color::isVisible): New helper. (WebCore::Color::alphaAsFloat): Gets the alpha value as a float. This replaces a bunch of places that were calculating it manually each time. Meanwhile, we might consider always exposing the primaries as floats... or at least have that option. (WebCore::isBlackColor): New helper - it was used in a couple of places. (WebCore::isWhiteColor): Ditto. (WebCore::Color::hasAlpha): Deleted. * platform/graphics/Gradient.cpp: Add FIXME. (WebCore::Gradient::addColorStop): * platform/graphics/Gradient.h: * platform/graphics/GraphicsContext.cpp: Use new helpers. (WebCore::GraphicsContext::computeLineBoundsAndAntialiasingModeForText): * platform/graphics/GraphicsContext.h: (WebCore::GraphicsContext::hasVisibleShadow): * platform/graphics/Image.cpp: Ditto. (WebCore::Image::fillWithSolidColor): * platform/graphics/ShadowBlur.cpp: Ditto. (WebCore::ShadowBlur::updateShadowBlurValues): * platform/graphics/ca/GraphicsLayerCA.cpp: Ditto. (WebCore::GraphicsLayerCA::setContentsToSolidColor): * platform/graphics/cg/GradientCG.cpp: (WebCore::Gradient::platformGradient): Add a FIXME to note that we can add ExtendedColor support simply by using CGColors, rather than fetching the components ourselves. * platform/graphics/cg/GraphicsContextCG.cpp: New helpers. (WebCore::calculateDrawingMode): * platform/graphics/cocoa/FontCascadeCocoa.mm: New helpers. (WebCore::FontCascade::drawGlyphs): * platform/graphics/mac/ColorMac.mm: Use the new helpers and Color::hash(). (WebCore::nsColor): * platform/graphics/texmap/TextureMapperGL.cpp: New helpers. (WebCore::TextureMapperGL::drawBorder): * rendering/BorderEdge.cpp: Ditto. (WebCore::BorderEdge::obscuresBackgroundEdge): (WebCore::BorderEdge::obscuresBackground): * rendering/RenderBox.cpp: Ditto. (WebCore::RenderBox::getBackgroundPaintedExtent): (WebCore::RenderBox::backgroundIsKnownToBeOpaqueInRect): (WebCore::RenderBox::backgroundHasOpaqueTopLayer): * rendering/RenderBoxModelObject.cpp: Ditto. (WebCore::RenderBoxModelObject::paintFillLayerExtended): (WebCore::colorNeedsAntiAliasAtCorner): (WebCore::willBeOverdrawn): (WebCore::RenderBoxModelObject::paintTranslucentBorderSides): (WebCore::RenderBoxModelObject::paintBorder): (WebCore::RenderBoxModelObject::boxShadowShouldBeAppliedToBackground): (WebCore::RenderBoxModelObject::paintBoxShadow): * rendering/RenderElement.cpp: (WebCore::RenderElement::paintOutline): * rendering/RenderInline.cpp: (WebCore::RenderInline::paintOutline): * rendering/RenderLayerBacking.cpp: (WebCore::canCreateTiledImage): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::viewHasTransparentBackground): * rendering/RenderMenuList.cpp: (RenderMenuList::getItemBackgroundColor): * rendering/RenderTheme.cpp: (WebCore::RenderTheme::disabledTextColor): * rendering/RenderView.cpp: (WebCore::RenderView::paintBoxDecorations): * rendering/TextDecorationPainter.cpp: (WebCore::TextDecorationPainter::paintTextDecoration): * rendering/TextPainter.cpp: (WebCore::TextPainter::paintTextWithShadows): * rendering/style/BorderValue.h: (WebCore::BorderValue::isTransparent): * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::visitedDependentColor): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::hasBackground): * rendering/svg/RenderSVGResource.cpp: (WebCore::requestPaintingResource): * rendering/svg/SVGInlineTextBox.cpp: (WebCore::SVGInlineTextBox::paintSelectionBackground): * svg/SVGAnimatedColor.cpp: Add a FIXME to note this is broken. (WebCore::SVGAnimatedColorAnimator::calculateAnimatedValue): Source/WebKit2: Implement argument coders for Color. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<Color>::encode): (IPC::ArgumentCoder<Color>::decode): * Shared/WebCoreArgumentCoders.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _updateScrollViewBackground]): LayoutTests: Tests that use the new color() syntax. * css3/color/backgrounds-and-borders-expected.html: Added. * css3/color/backgrounds-and-borders.html: Added. * css3/color/box-shadows-expected.html: Added. * css3/color/box-shadows.html: Added. * css3/color/canvas-expected.html: Added. * css3/color/canvas.html: Added. * css3/color/composited-solid-backgrounds-expected.html: Added. * css3/color/composited-solid-backgrounds.html: Added. * css3/color/text-expected.html: Added. * css3/color/text.html: Added. * editing/mac/attributed-string/anchor-element-expected.txt: Updated. * editing/mac/attributed-string/basic-expected.txt: Canonical link: https://commits.webkit.org/182191@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208460 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-09 19:56:17 +00:00
<style>
body {
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10"><g fill="#ccc"><rect width="5" height="5"/><rect x="5" y="5" width="5" height="5"/></g></svg>');
background-size: 100px 100px;
}
:root {
--x: black;
}
.box {
display: inline-block;
width: 60px;
height: 60px;
background-color: #666;
box-shadow: 3px 3px 3px var(--x);
margin: 10px 10px;
}
</style>
<p>These two rows should be identical</p>
<div class="box" style="--x: red;"></div>
<div class="box" style="--x: rgb(0, 255, 0);"></div>
<div class="box" style="--x: blue;"></div>
<div class="box" style="--x: rgba(255, 0, 0, 0.6);"></div>
<div class="box" style="--x: rgba(0, 255, 0, 0.6);"></div>
<div class="box" style="--x: rgba(0, 0, 255, 0.6);"></div>
<br>
<div class="box" style="--x: red;"></div>
<div class="box" style="--x: rgb(0, 255, 0);"></div>
<div class="box" style="--x: blue;"></div>
<div class="box" style="--x: rgba(255, 0, 0, 0.6);"></div>
<div class="box" style="--x: rgba(0, 255, 0, 0.6);"></div>
<div class="box" style="--x: rgba(0, 0, 255, 0.6);"></div>