Source/WebCore/ChangeLog

 12011-10-27 Simon Fraser <simon.fraser@apple.com>
 2
 3 The HTML5 video element in Safari does not respect "visibility:hidden" CSS property
 4 https://bugs.webkit.org/show_bug.cgi?id=38829
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Make compositiong and CSS visibility play nicely together.
 9
 10 The main issue was that an old optimization (see bug 4377) caused
 11 visibility:hidden layers to not appear in the z-order lists, but those
 12 layers could still become composited, but would remain detached. In addition,
 13 composited layers which were visibility:hidden would become visible sometimes.
 14
 15 With this fix, the z-order lists always contain all layers when the page
 16 is in compositing mode. GraphicsLayer is changed to ensure that visibility:hidden
 17 layers show no content, and visible descendants of hidden layers work correctly.
 18
 19 Tests: compositing/visibility/visibility-composited-transforms.html
 20 compositing/visibility/visibility-composited.html
 21 compositing/visibility/visibility-image-layers-dynamic.html
 22 compositing/visibility/visibility-image-layers.html
 23
 24 * platform/graphics/GraphicsLayer.cpp:
 25 (WebCore::GraphicsLayer::GraphicsLayer): Init m_contentsVisible to true.
 26 (WebCore::GraphicsLayer::dumpProperties): Dump m_contentsVisible if not true.
 27 * platform/graphics/GraphicsLayer.h:
 28 (WebCore::GraphicsLayer::contentsAreVisible): Getter for m_contentsVisible.
 29 (WebCore::GraphicsLayer::setContentsVisible): Setter for m_contentsVisible.
 30 * platform/graphics/ca/GraphicsLayerCA.cpp:
 31 (WebCore::GraphicsLayerCA::setContentsVisible): Override setContentsVisible.
 32 (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers): Handle ContentsVisibilityChanged
 33 flag
 34 (WebCore::GraphicsLayerCA::updateSublayerList): Only parent the m_contentsLayer if the layer
 35 has visible contents.
 36 (WebCore::GraphicsLayerCA::updateContentsVisibility): For bits painted into the layer itself,
 37 we hide it by clearing the backing store.
 38 * platform/graphics/ca/GraphicsLayerCA.h: Removed obsolete comment on the DrawsContentChanged flag,
 39 added ContentsVisibilityChanged flag.
 40 * rendering/RenderLayer.cpp:
 41 (WebCore::RenderLayer::updateZOrderLists): If we're in compositing mode, include all layers
 42 in the z-order lists.
 43 (WebCore::RenderLayer::collectLayers): New param to specify whether we need to collect all layers.
 44 * rendering/RenderLayer.h:
 45 (WebCore::RenderLayer::hasVisibleDescendant): Add comment about the need for an assertion in hasVisibleContent()
 46 , and assertion in hasVisibleDescendant().
 47 * rendering/RenderLayerBacking.cpp:
 48 (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): Call setContentsVisible() on the GraphicsLayer.
 49 (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer): We can use simple container layers in cases
 50 where visibility:hidden causes layer content to not be drawn.
 51 (WebCore::RenderLayerBacking::hasVisibleNonCompositingDescendants): Renamed from hasNonCompositingDescendants()
 52 because it now also looks at visibility to decide when things are visible.
 53 * rendering/RenderLayerBacking.h: hasNonCompositingDescendants() renamed to hasVisibleNonCompositingDescendants().
 54
1552011-10-27 Michael Saboff <msaboff@apple.com>
256
357 Investigate storing strings in 8-bit buffers when possible

Source/WebCore/platform/graphics/GraphicsLayer.cpp

@@GraphicsLayer::GraphicsLayer(GraphicsLayerClient* client)
7777 , m_usingTiledLayer(false)
7878 , m_masksToBounds(false)
7979 , m_drawsContent(false)
 80 , m_contentsVisible(true)
8081 , m_acceleratesDrawing(false)
8182 , m_maintainsPixelAlignment(false)
8283 , m_appliesPageScale(false)

@@void GraphicsLayer::dumpProperties(TextStream& ts, int indent, LayerTreeAsTextBe
504505 ts << "(drawsContent " << m_drawsContent << ")\n";
505506 }
506507
 508 if (!m_contentsVisible) {
 509 writeIndent(ts, indent + 1);
 510 ts << "(contentsVisible " << m_contentsVisible << ")\n";
 511 }
 512
507513 if (!m_backfaceVisibility) {
508514 writeIndent(ts, indent + 1);
509515 ts << "(backfaceVisibility " << (m_backfaceVisibility ? "visible" : "hidden") << ")\n";

Source/WebCore/platform/graphics/GraphicsLayer.h

@@public:
264264 bool drawsContent() const { return m_drawsContent; }
265265 virtual void setDrawsContent(bool b) { m_drawsContent = b; }
266266
 267 bool contentsAreVisible() const { return m_contentsVisible; }
 268 virtual void setContentsVisible(bool b) { m_contentsVisible = b; }
 269
267270 bool acceleratesDrawing() const { return m_acceleratesDrawing; }
268271 virtual void setAcceleratesDrawing(bool b) { m_acceleratesDrawing = b; }
269272

@@protected:
424427 bool m_usingTiledLayer : 1;
425428 bool m_masksToBounds : 1;
426429 bool m_drawsContent : 1;
 430 bool m_contentsVisible : 1;
427431 bool m_acceleratesDrawing : 1;
428432 bool m_maintainsPixelAlignment : 1;
429433 bool m_appliesPageScale : 1; // Set for the layer which has the page scale applied to it.

Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

@@void GraphicsLayerCA::setDrawsContent(bool drawsContent)
490490 noteLayerPropertyChanged(DrawsContentChanged);
491491}
492492
 493void GraphicsLayerCA::setContentsVisible(bool contentsVisible)
 494{
 495 if (contentsVisible == m_contentsVisible)
 496 return;
 497
 498 GraphicsLayer::setContentsVisible(contentsVisible);
 499 noteLayerPropertyChanged(ContentsVisibilityChanged);
 500 // Visibility affects whether the contentsLayer is parented.
 501 if (m_contentsLayer)
 502 noteSublayersChanged();
 503}
 504
493505void GraphicsLayerCA::setAcceleratesDrawing(bool acceleratesDrawing)
494506{
495507 if (acceleratesDrawing == m_acceleratesDrawing)

@@void GraphicsLayerCA::commitLayerChangesBeforeSublayers(float pageScaleFactor, c
952964 if (m_uncommittedChanges & DrawsContentChanged)
953965 updateLayerDrawsContent(pageScaleFactor, positionRelativeToBase);
954966
 967 if (m_uncommittedChanges & ContentsVisibilityChanged)
 968 updateContentsVisibility();
 969
955970 if (m_uncommittedChanges & ContentsOpaqueChanged)
956971 updateContentsOpaque();
957972

@@void GraphicsLayerCA::updateSublayerList()
10211036 newSublayers.append(static_cast<GraphicsLayerCA*>(m_replicaLayer)->primaryLayer());
10221037 // Add the primary layer. Even if we have negative z-order children, the primary layer always comes behind.
10231038 newSublayers.append(m_layer);
1024  } else if (m_contentsLayer) {
 1039 } else if (m_contentsLayer && m_contentsVisible) {
10251040 // FIXME: add the contents layer in the correct order with negative z-order children.
10261041 // This does not cause visible rendering issues because currently contents layers are only used
10271042 // for replaced elements that don't have children.

@@void GraphicsLayerCA::updateSublayerList()
10511066 // If we have a transform layer, then the contents layer is parented in the
10521067 // primary layer (which is itself a child of the transform layer).
10531068 m_layer->removeAllSublayers();
1054  m_layer->appendSublayer(m_contentsLayer.get());
 1069 if (m_contentsVisible)
 1070 m_layer->appendSublayer(m_contentsLayer.get());
10551071 }
10561072 } else
10571073 m_layer->setSublayers(newSublayers);

@@void GraphicsLayerCA::updateMasksToBounds()
11751191 updateDebugIndicators();
11761192}
11771193
 1194void GraphicsLayerCA::updateContentsVisibility()
 1195{
 1196 // Note that m_contentsVisible also affects whether m_contentsLayer is parented.
 1197 if (m_contentsVisible) {
 1198 if (m_drawsContent)
 1199 m_layer->setNeedsDisplay();
 1200 } else {
 1201 m_layer.get()->setContents(0);
 1202
 1203 if (LayerMap* layerCloneMap = m_layerClones.get()) {
 1204 LayerMap::const_iterator end = layerCloneMap->end();
 1205 for (LayerMap::const_iterator it = layerCloneMap->begin(); it != end; ++it)
 1206 it->second->setContents(0);
 1207 }
 1208 }
 1209}
 1210
11781211void GraphicsLayerCA::updateContentsOpaque()
11791212{
11801213 m_layer.get()->setOpaque(m_contentsOpaque);

Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h

@@public:
8585 virtual void setPreserves3D(bool);
8686 virtual void setMasksToBounds(bool);
8787 virtual void setDrawsContent(bool);
 88 virtual void setContentsVisible(bool);
8889 virtual void setAcceleratesDrawing(bool);
8990
9091 virtual void setBackgroundColor(const Color&);

@@private:
278279 void updateTransform();
279280 void updateChildrenTransform();
280281 void updateMasksToBounds();
 282 void updateContentsVisibility();
281283 void updateContentsOpaque();
282284 void updateBackfaceVisibility();
283285 void updateStructuralLayer(float pixelAlignmentScale, const FloatPoint& positionRelativeToBase);

@@private:
321323 ChildrenTransformChanged = 1 << 5,
322324 Preserves3DChanged = 1 << 6,
323325 MasksToBoundsChanged = 1 << 7,
324  DrawsContentChanged = 1 << 8, // need this?
 326 DrawsContentChanged = 1 << 8,
325327 BackgroundColorChanged = 1 << 9,
326328 ContentsOpaqueChanged = 1 << 10,
327329 BackfaceVisibilityChanged = 1 << 11,

@@private:
336338 ReplicatedLayerChanged = 1 << 20,
337339 ContentsNeedsDisplay = 1 << 21,
338340 AcceleratesDrawingChanged = 1 << 22,
339  ContentsScaleChanged = 1 << 23
 341 ContentsScaleChanged = 1 << 23,
 342 ContentsVisibilityChanged = 1 << 24
340343 };
341344 typedef unsigned LayerChangeFlags;
342345 void noteLayerPropertyChanged(LayerChangeFlags flags);

Source/WebCore/rendering/RenderLayer.cpp

@@void RenderLayer::updateZOrderLists()
40064006 if (!isStackingContext() || !m_zOrderListsDirty)
40074007 return;
40084008
 4009 bool includeHiddenLayers = compositor()->inCompositingMode();
40094010 for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
40104011 if (!m_reflection || reflectionLayer() != child)
4011  child->collectLayers(m_posZOrderList, m_negZOrderList);
 4012 child->collectLayers(includeHiddenLayers, m_posZOrderList, m_negZOrderList);
40124013
40134014 // Sort the two lists.
40144015 if (m_posZOrderList)

@@void RenderLayer::updateNormalFlowList()
40374038 m_normalFlowListDirty = false;
40384039}
40394040
4040 void RenderLayer::collectLayers(Vector<RenderLayer*>*& posBuffer, Vector<RenderLayer*>*& negBuffer)
 4041void RenderLayer::collectLayers(bool includeHiddenLayers, Vector<RenderLayer*>*& posBuffer, Vector<RenderLayer*>*& negBuffer)
40414042{
40424043 updateVisibilityStatus();
40434044
40444045 // Overflow layers are just painted by their enclosing layers, so they don't get put in zorder lists.
4045  if ((m_hasVisibleContent || (m_hasVisibleDescendant && isStackingContext())) && !isNormalFlowOnly() && !renderer()->isRenderFlowThread()) {
 4046 bool includeHiddenLayer = includeHiddenLayers || (m_hasVisibleContent || (m_hasVisibleDescendant && isStackingContext()));
 4047 if (includeHiddenLayer && !isNormalFlowOnly() && !renderer()->isRenderFlowThread()) {
40464048 // Determine which buffer the child should be in.
40474049 Vector<RenderLayer*>*& buffer = (zIndex() >= 0) ? posBuffer : negBuffer;
40484050

@@void RenderLayer::collectLayers(Vector<RenderLayer*>*& posBuffer, Vector<RenderL
40564058
40574059 // Recur into our children to collect more layers, but only if we don't establish
40584060 // a stacking context.
4059  if (m_hasVisibleDescendant && !isStackingContext()) {
 4061 if ((includeHiddenLayers || m_hasVisibleDescendant) && !isStackingContext()) {
40604062 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) {
40614063 // Ignore reflections.
40624064 if (!m_reflection || reflectionLayer() != child)
4063  child->collectLayers(posBuffer, negBuffer);
 4065 child->collectLayers(includeHiddenLayers, posBuffer, negBuffer);
40644066 }
40654067 }
40664068}

Source/WebCore/rendering/RenderLayer.h

@@public:
385385 void updateNormalFlowList();
386386 Vector<RenderLayer*>* normalFlowList() const { return m_normalFlowList; }
387387
 388 // FIXME: We should ASSERT(!m_visibleContentStatusDirty) here, but see https://bugs.webkit.org/show_bug.cgi?id=71044
388389 bool hasVisibleContent() const { return m_hasVisibleContent; }
389  bool hasVisibleDescendant() const { return m_hasVisibleDescendant; }
 390 bool hasVisibleDescendant() const { ASSERT(!m_visibleDescendantStatusDirty); return m_hasVisibleDescendant; }
390391 void setHasVisibleContent(bool);
391392 void dirtyVisibleContentStatus();
392393

@@private:
544545 LayoutUnit renderBoxX() const { return renderBoxLocation().x(); }
545546 LayoutUnit renderBoxY() const { return renderBoxLocation().y(); }
546547
547  void collectLayers(Vector<RenderLayer*>*&, Vector<RenderLayer*>*&);
 548 void collectLayers(bool includeHiddenLayers, Vector<RenderLayer*>*&, Vector<RenderLayer*>*&);
548549
549550 void updateLayerListsIfNeeded();
550551 void updateCompositingAndLayerListsIfNeeded();

Source/WebCore/rendering/RenderLayerBacking.cpp

@@void RenderLayerBacking::updateGraphicsLayerGeometry()
360360 if (!renderer()->animation()->isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPropertyOpacity))
361361 updateLayerOpacity(renderer()->style());
362362
 363 m_owningLayer->updateVisibilityStatus();
 364 m_graphicsLayer->setContentsVisible(m_owningLayer->hasVisibleContent());
 365
363366 RenderStyle* style = renderer()->style();
364367 m_graphicsLayer->setPreserves3D(style->transformStyle3D() == TransformStyle3DPreserve3D && !renderer()->hasReflection());
365368 m_graphicsLayer->setBackfaceVisibility(style->backfaceVisibility() == BackfaceVisibilityVisible);

@@bool RenderLayerBacking::isSimpleContainerCompositingLayer() const
788791 return false;
789792
790793 RenderStyle* style = renderObject->style();
 794 bool isVisible = m_owningLayer->hasVisibleContent();
791795
792796 // Reject anything that has a border, a border-radius or outline,
793797 // or any background (color or image).
794798 // FIXME: we could optimize layers for simple backgrounds.
795  if (hasBoxDecorationsOrBackground(renderObject))
 799 if (isVisible && hasBoxDecorationsOrBackground(renderObject))
796800 return false;
797801
798  if (m_owningLayer->hasOverflowControls())
 802 if (isVisible && m_owningLayer->hasOverflowControls())
799803 return false;
800804
801805 // If we have got this far and the renderer has no children, then we're ok.

@@bool RenderLayerBacking::isSimpleContainerCompositingLayer() const
827831 return false;
828832
829833 // Check to see if all the body's children are compositing layers.
830  if (hasNonCompositingDescendants())
 834 if (hasVisibleNonCompositingDescendants())
831835 return false;
832836
833837 return true;
834838 }
835839
836840 // Check to see if all the renderer's children are compositing layers.
837  if (hasNonCompositingDescendants())
 841 if (isVisible && hasVisibleNonCompositingDescendants())
838842 return false;
839843
840844 return true;
841845}
842846
843847// Conservative test for having no rendered children.
844 bool RenderLayerBacking::hasNonCompositingDescendants() const
 848bool RenderLayerBacking::hasVisibleNonCompositingDescendants() const
845849{
846850 // Some HTML can cause whitespace text nodes to have renderers, like:
847851 // <div>

@@bool RenderLayerBacking::hasNonCompositingDescendants() const
858862 }
859863 }
860864
 865 if (Vector<RenderLayer*>* normalFlowList = m_owningLayer->normalFlowList()) {
 866 size_t listSize = normalFlowList->size();
 867 for (size_t i = 0; i < listSize; ++i) {
 868 RenderLayer* curLayer = normalFlowList->at(i);
 869 if (!curLayer->isComposited() && curLayer->hasVisibleContent())
 870 return true;
 871 }
 872 }
 873
861874 if (m_owningLayer->isStackingContext()) {
 875 if (!m_owningLayer->hasVisibleDescendant())
 876 return false;
 877
862878 // Use the m_hasCompositingDescendant bit to optimize?
863879 if (Vector<RenderLayer*>* negZOrderList = m_owningLayer->negZOrderList()) {
864880 size_t listSize = negZOrderList->size();
865881 for (size_t i = 0; i < listSize; ++i) {
866882 RenderLayer* curLayer = negZOrderList->at(i);
867  if (!curLayer->isComposited())
 883 if (!curLayer->isComposited() && curLayer->hasVisibleContent())
868884 return true;
869885 }
870886 }

@@bool RenderLayerBacking::hasNonCompositingDescendants() const
873889 size_t listSize = posZOrderList->size();
874890 for (size_t i = 0; i < listSize; ++i) {
875891 RenderLayer* curLayer = posZOrderList->at(i);
876  if (!curLayer->isComposited())
 892 if (!curLayer->isComposited() && curLayer->hasVisibleContent())
877893 return true;
878894 }
879895 }
880896 }
881897
882  if (Vector<RenderLayer*>* normalFlowList = m_owningLayer->normalFlowList()) {
883  size_t listSize = normalFlowList->size();
884  for (size_t i = 0; i < listSize; ++i) {
885  RenderLayer* curLayer = normalFlowList->at(i);
886  if (!curLayer->isComposited())
887  return true;
888  }
889  }
890 
891898 return false;
892899}
893900

Source/WebCore/rendering/RenderLayerBacking.h

@@private:
188188 Color rendererBackgroundColor() const;
189189 void updateBackgroundColor();
190190
191  bool hasNonCompositingDescendants() const;
 191 bool hasVisibleNonCompositingDescendants() const;
192192
193193 void paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*, const LayoutRect& paintDirtyRect, PaintBehavior, GraphicsLayerPaintingPhase, RenderObject* paintingRoot);
194194

LayoutTests/ChangeLog

 12011-10-27 Simon Fraser <simon.fraser@apple.com>
 2
 3 The HTML5 video element in Safari does not respect "visibility:hidden" CSS property
 4 https://bugs.webkit.org/show_bug.cgi?id=38829
 5
 6 Test various configurations of compositing layers and visibility.
 7
 8 Reviewed by NOBODY (OOPS!).
 9
 10 * compositing/visibility/visibility-composited-expected.png: Added.
 11 * compositing/visibility/visibility-composited-transforms-expected.png: Added.
 12 * compositing/visibility/visibility-composited-transforms.html: Added.
 13 * compositing/visibility/visibility-composited.html: Added.
 14 * compositing/visibility/visibility-image-layers-dynamic-expected.txt: Added.
 15 * compositing/visibility/visibility-image-layers-dynamic.html: Added.
 16 * compositing/visibility/visibility-image-layers-expected.png: Added.
 17 * compositing/visibility/visibility-image-layers.html: Added.
 18
1192011-10-27 John Gregg <johnnyg@google.com>
220
321 Unreviewed, more chromium baselines for new multicol tests.

LayoutTests/compositing/visibility/visibility-composited-expected.png

Exception raised during decoding git binary patch:
Error: git binary content does not match index 0000000000000000000000000000000000000000
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:1023:in `extract_contents_from_git_binary_literal_chunk'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:1042:in `extract_contents_from_remote'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:717:in `initialize'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:850:in `new'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:850:in `block in parse'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:850:in `collect'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:850:in `parse'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:25:in `prettify'
/var/www/html/PrettyPatch/prettify.rb:30:in `<main>'

LayoutTests/compositing/visibility/visibility-composited-transforms-expected.png

Exception raised during decoding git binary patch:
Error: git binary content does not match index 0000000000000000000000000000000000000000
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:1023:in `extract_contents_from_git_binary_literal_chunk'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:1042:in `extract_contents_from_remote'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:717:in `initialize'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:850:in `new'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:850:in `block in parse'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:850:in `collect'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:850:in `parse'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:25:in `prettify'
/var/www/html/PrettyPatch/prettify.rb:30:in `<main>'

LayoutTests/compositing/visibility/visibility-composited-transforms.html

 1<!DOCTYPE html>
 2
 3<html>
 4<head>
 5 <style>
 6 .container {
 7 -webkit-perspective: 500px;
 8 }
 9 .set {
 10 position: absolute;
 11 top: 8px;
 12 }
 13 .box {
 14 height: 100px;
 15 width: 100px;
 16 }
 17
 18 .hidden {
 19 visibility: hidden;
 20 }
 21
 22 .visible {
 23 visibility: visible;
 24 }
 25
 26 .should-be-visible {
 27 background-color: green !important;
 28 }
 29 .composited {
 30 -webkit-transform: rotate3d(0, 0, 1, 45deg);
 31 }
 32
 33 .hidden-indicator {
 34 background-color: red;
 35 }
 36
 37 .intermediate {
 38 -webkit-transform: rotate3d(0, 0, 1, -45deg);
 39 -webkit-transform-style: preserve-3d;
 40 background-color: red;
 41 }
 42 </style>
 43</head>
 44<body>
 45 <!-- Tests that a transform on a hidden div affects its visible children. -->
 46 <!-- You should see a single green box, with no red. -->
 47
 48 <div class="set">
 49 <div class="hidden-indicator box"></div>
 50 </div>
 51
 52 <div class="set">
 53 <div class="container">
 54 <div class="hidden intermediate">
 55 <div class="visible composited box should-be-visible"></div>
 56 </div>
 57 </div>
 58
 59 </div>
 60</body>
 61</html>

LayoutTests/compositing/visibility/visibility-composited.html

 1<!DOCTYPE html>
 2
 3<html>
 4<head>
 5 <style>
 6 .set {
 7 position: absolute;
 8 top: 8px;
 9 }
 10 .box {
 11 height: 100px;
 12 width: 100px;
 13 background-color: blue;
 14 }
 15
 16 .hidden {
 17 visibility: hidden;
 18 }
 19
 20 .container.hidden {
 21 outline: 4px solid red;
 22 }
 23
 24 .visible {
 25 visibility: visible;
 26 }
 27 .should-be-hidden {
 28 background-color: red !important;
 29 }
 30 .should-be-visible {
 31 background-color: green !important;
 32 }
 33 .composited {
 34 -webkit-transform: translateZ(1px);
 35 }
 36
 37 .visible-indicator {
 38 background-color: green;
 39 }
 40
 41 .hidden-indicator {
 42 background-color: red;
 43 }
 44 </style>
 45</head>
 46<body>
 47 <!-- Tests various configurations of visibility:hidden and visible compositing layers. -->
 48 <!-- You should see a green vertical bar, with no red. -->
 49 <div class="set">
 50 <div class="visible-indicator box"></div>
 51 <div class="visible-indicator box"></div>
 52 <div class="hidden-indicator box"></div>
 53 </div>
 54
 55 <div class="set">
 56 <div class="container">
 57 <div class="hidden composited box should-be-hidden">
 58 </div>
 59 </div>
 60
 61 <div class="hidden container">
 62 <div class="composited box should-be-hidden">
 63 </div>
 64 </div>
 65
 66 <div class="hidden container">
 67 <div class="visible composited box should-be-visible">
 68 </div>
 69 </div>
 70 </div>
 71</body>
 72</html>

LayoutTests/compositing/visibility/visibility-image-layers-dynamic-expected.txt

 1
 2
 3
 4Initial
 5
 6(GraphicsLayer
 7 (bounds 785.00 622.00)
 8 (children 1
 9 (GraphicsLayer
 10 (bounds 785.00 622.00)
 11 (children 3
 12 (GraphicsLayer
 13 (position 14.00 6.00)
 14 (bounds 757.00 152.00)
 15 (children 1
 16 (GraphicsLayer
 17 (position 20.00 20.00)
 18 (bounds 108.00 108.00)
 19 (contentsVisible 0)
 20 )
 21 )
 22 )
 23 (GraphicsLayer
 24 (position 14.00 160.00)
 25 (bounds 757.00 152.00)
 26 (contentsVisible 0)
 27 (children 1
 28 (GraphicsLayer
 29 (position 20.00 20.00)
 30 (bounds 108.00 108.00)
 31 (contentsVisible 0)
 32 )
 33 )
 34 )
 35 (GraphicsLayer
 36 (position 14.00 314.00)
 37 (bounds 757.00 152.00)
 38 (contentsVisible 0)
 39 (children 1
 40 (GraphicsLayer
 41 (position 20.00 20.00)
 42 (bounds 108.00 108.00)
 43 )
 44 )
 45 )
 46 )
 47 )
 48 )
 49)
 50After step 1
 51
 52(GraphicsLayer
 53 (bounds 785.00 1301.00)
 54 (children 1
 55 (GraphicsLayer
 56 (bounds 785.00 1301.00)
 57 (children 3
 58 (GraphicsLayer
 59 (position 14.00 6.00)
 60 (bounds 757.00 152.00)
 61 (children 1
 62 (GraphicsLayer
 63 (position 20.00 20.00)
 64 (bounds 108.00 108.00)
 65 )
 66 )
 67 )
 68 (GraphicsLayer
 69 (position 14.00 160.00)
 70 (bounds 757.00 152.00)
 71 (contentsVisible 0)
 72 (children 1
 73 (GraphicsLayer
 74 (position 20.00 20.00)
 75 (bounds 108.00 108.00)
 76 (contentsVisible 0)
 77 )
 78 )
 79 )
 80 (GraphicsLayer
 81 (position 14.00 314.00)
 82 (bounds 757.00 152.00)
 83 (contentsVisible 0)
 84 (children 1
 85 (GraphicsLayer
 86 (position 20.00 20.00)
 87 (bounds 108.00 108.00)
 88 )
 89 )
 90 )
 91 )
 92 )
 93 )
 94)
 95After step 2
 96
 97(GraphicsLayer
 98 (bounds 785.00 1965.00)
 99 (children 1
 100 (GraphicsLayer
 101 (bounds 785.00 1965.00)
 102 (children 3
 103 (GraphicsLayer
 104 (position 14.00 6.00)
 105 (bounds 757.00 152.00)
 106 (children 1
 107 (GraphicsLayer
 108 (position 20.00 20.00)
 109 (bounds 108.00 108.00)
 110 )
 111 )
 112 )
 113 (GraphicsLayer
 114 (position 14.00 160.00)
 115 (bounds 757.00 152.00)
 116 (drawsContent 1)
 117 (children 1
 118 (GraphicsLayer
 119 (position 20.00 20.00)
 120 (bounds 108.00 108.00)
 121 )
 122 )
 123 )
 124 (GraphicsLayer
 125 (position 14.00 314.00)
 126 (bounds 757.00 152.00)
 127 (contentsVisible 0)
 128 (children 1
 129 (GraphicsLayer
 130 (position 20.00 20.00)
 131 (bounds 108.00 108.00)
 132 )
 133 )
 134 )
 135 )
 136 )
 137 )
 138)
 139

LayoutTests/compositing/visibility/visibility-image-layers-dynamic.html

 1<!DOCTYPE html>
 2
 3<html>
 4<head>
 5 <style>
 6 .set {
 7 position: absolute;
 8 top: 8px;
 9 }
 10 .box {
 11 height: 100px;
 12 width: 100px;
 13/* background-color: blue;*/
 14 }
 15
 16 .hidden {
 17 visibility: hidden;
 18 }
 19
 20 .container {
 21 margin: 10px;
 22 padding: 20px;
 23 }
 24 .container.hidden {
 25 outline: 4px solid red;
 26 }
 27
 28 .visible {
 29 visibility: visible;
 30 }
 31 .should-be-hidden {
 32 background-color: red !important;
 33 }
 34 .should-be-visible {
 35 background-color: green !important;
 36 }
 37 .composited {
 38 -webkit-transform: translateZ(0);
 39 }
 40
 41 .visible-indicator {
 42 background-color: green;
 43 }
 44
 45 .hidden-indicator {
 46 background-color: red;
 47 }
 48 </style>
 49 <script>
 50 if (window.layoutTestController) {
 51 layoutTestController.dumpAsText();
 52 layoutTestController.waitUntilDone();
 53 }
 54
 55 function doTest()
 56 {
 57 if (window.layoutTestController)
 58 document.getElementById('layers1').innerText = layoutTestController.layerTreeAsText();
 59
 60 window.setTimeout(function() {
 61 var firstImage = document.querySelectorAll('img')[0];
 62 firstImage.style.visibility = 'visible';
 63
 64 if (window.layoutTestController)
 65 document.getElementById('layers2').innerText = layoutTestController.layerTreeAsText();
 66
 67 window.setTimeout(function() {
 68 var secondContainer = document.querySelectorAll('.container')[1];
 69 secondContainer.style.visibility = 'visible';
 70
 71 if (window.layoutTestController) {
 72 document.getElementById('layers3').innerText = layoutTestController.layerTreeAsText();
 73 layoutTestController.notifyDone();
 74 }
 75 }, 0);
 76 }, 0);
 77 }
 78 window.addEventListener('load', doTest, false);
 79 </script>
 80</head>
 81<body>
 82 <!-- Tests dynamic changes of visibility, using directly composited images. -->
 83 <div class="composited container"><img src="../resources/thiswayup.png" class="hidden composited box"></div>
 84 <div class="composited hidden container"><img src="../resources/thiswayup.png" class="composited box"></div>
 85 <div class="composited hidden container"><img src="../resources/thiswayup.png" class="visible composited box"></div>
 86
 87<h2>Initial</h2>
 88<pre id="layers1"></pre>
 89
 90<h2>After step 1</h2>
 91<pre id="layers2"></pre>
 92
 93<h2>After step 2</h2>
 94<pre id="layers3"></pre>
 95</body>
 96</html>

LayoutTests/compositing/visibility/visibility-image-layers-expected.png

Exception raised during decoding git binary patch:
Error: git binary content does not match index 0000000000000000000000000000000000000000
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:1023:in `extract_contents_from_git_binary_literal_chunk'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:1042:in `extract_contents_from_remote'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:717:in `initialize'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:850:in `new'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:850:in `block in parse'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:850:in `collect'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:850:in `parse'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:25:in `prettify'
/var/www/html/PrettyPatch/prettify.rb:30:in `<main>'

LayoutTests/compositing/visibility/visibility-image-layers.html

 1<!DOCTYPE html>
 2
 3<html>
 4<head>
 5 <style>
 6 .set {
 7 display: inline-block;
 8 border: 1px solid black;
 9 }
 10 .box {
 11 height: 100px;
 12 width: 100px;
 13/* background-color: blue;*/
 14 }
 15
 16 .hidden {
 17 visibility: hidden;
 18 }
 19
 20 .container {
 21 margin: 10px;
 22 padding: 20px;
 23 }
 24 .container.hidden {
 25 outline: 4px solid red;
 26 }
 27
 28 .visible {
 29 visibility: visible;
 30 }
 31 .should-be-hidden {
 32 background-color: red !important;
 33 }
 34 .should-be-visible {
 35 background-color: green !important;
 36 }
 37 .composited {
 38 -webkit-transform: translateZ(1px);
 39 }
 40
 41 .visible-indicator {
 42 background-color: green;
 43 }
 44
 45 .hidden-indicator {
 46 background-color: red;
 47 }
 48 </style>
 49 <script>
 50 if (window.layoutTestController)
 51 layoutTestController.dumpAsText(true);
 52 </script>
 53</head>
 54<body>
 55 <!-- Tests visibility with directly composited images. -->
 56 <!-- Left and right sides should look the same -->
 57 <div class="set">
 58 <div class="container"><img src="../resources/thiswayup.png" class="hidden box"></div>
 59 <div class="hidden container"><img src="../resources/thiswayup.png" class="box"></div>
 60 <div class="hidden container"><img src="../resources/thiswayup.png" class="visible box"></div>
 61 </div>
 62
 63 <div class="set">
 64 <div class="composited container"><img src="../resources/thiswayup.png" class="hidden composited box"></div>
 65 <div class="composited hidden container"><img src="../resources/thiswayup.png" class="composited box"></div>
 66 <div class="composited hidden container"><img src="../resources/thiswayup.png" class="visible composited box"></div>
 67 </div>
 68</body>
 69</html>