author | Ed Morley <emorley@mozilla.com> |
Tue, 22 Jul 2014 17:30:16 +0100 | |
changeset 195526 | e740a64c284bb1f227ced27770296d0464944dbe |
parent 195494 | e5ced39f443bacc221ac4bd41f465bcc746aeb04 (current diff) |
parent 195525 | 4d5d939010e5ace0bdcfc5968e3b3e5788e2dc38 (diff) |
child 195527 | 0ad20ad7b70ae9a679af9211c0f7b1b34532b3e3 |
push id | 27184 |
push user | kwierso@gmail.com |
push date | Wed, 23 Jul 2014 00:39:18 +0000 |
treeherder | mozilla-central@0ad20ad7b70a [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
milestone | 34.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/CLOBBER +++ b/CLOBBER @@ -17,9 +17,9 @@ # # Modifying this file will now automatically clobber the buildbot machines \o/ # # Are you updating CLOBBER because you think it's needed for your WebIDL # changes to stick? As of bug 928195, this shouldn't be necessary! Please # don't change CLOBBER for WebIDL changes any more. -Merge day clobber \ No newline at end of file +Apparently something in bug 984711 & friends breaks CSS2Properties.webidl in non-clobber builds.
--- a/accessible/generic/moz.build +++ b/accessible/generic/moz.build @@ -25,16 +25,17 @@ UNIFIED_SOURCES += [ 'TextLeafAccessible.cpp', ] LOCAL_INCLUDES += [ '/accessible/base', '/accessible/html', '/accessible/xpcom', '/accessible/xul', + '/content/base/src', '/layout/generic', '/layout/xul', ] if CONFIG['MOZ_ENABLE_GTK']: LOCAL_INCLUDES += [ '/accessible/atk', ]
--- a/browser/modules/test/browser_UITour_panel_close_annotation.js +++ b/browser/modules/test/browser_UITour_panel_close_annotation.js @@ -30,34 +30,34 @@ let tests = [ waitForElementToBeVisible(highlight, function checkPanelIsOpen() { isnot(PanelUI.panel.state, "closed", "Panel should have opened"); // Move the highlight outside which should close the app menu. gContentAPI.showHighlight("appMenu"); waitForPopupAtAnchor(highlight.parentElement, document.getElementById("PanelUI-button"), () => { isnot(PanelUI.panel.state, "open", "Panel should have closed after the highlight moved elsewhere."); - is(tooltip.state, "open", "The info panel should have remained open"); + ok(tooltip.state == "showing" || tooltip.state == "open", "The info panel should have remained open"); done(); }, "Highlight should move to the appMenu button and still be visible"); }, "Highlight should be shown after showHighlight() for fixed panel items"); }, function test_highlight_panel_hideMenu(done) { gContentAPI.showHighlight("customize"); gContentAPI.showInfo("search", "test title", "test text"); waitForElementToBeVisible(highlight, function checkPanelIsOpen() { isnot(PanelUI.panel.state, "closed", "Panel should have opened"); // Close the app menu and make sure the highlight also disappeared. gContentAPI.hideMenu("appMenu"); waitForElementToBeHidden(highlight, function checkPanelIsClosed() { isnot(PanelUI.panel.state, "open", "Panel still should have closed"); - is(tooltip.state, "open", "The info panel should have remained open"); + ok(tooltip.state == "showing" || tooltip.state == "open", "The info panel should have remained open"); done(); }, "Highlight should have disappeared when panel closed"); }, "Highlight should be shown after showHighlight() for fixed panel items"); }, function test_highlight_panel_click_find(done) { gContentAPI.showHighlight("help"); gContentAPI.showInfo("searchProvider", "test title", "test text"); @@ -65,17 +65,17 @@ let tests = [ isnot(PanelUI.panel.state, "closed", "Panel should have opened"); // Click the find button which should close the panel. let findButton = document.getElementById("find-button"); EventUtils.synthesizeMouseAtCenter(findButton, {}); waitForElementToBeHidden(highlight, function checkPanelIsClosed() { isnot(PanelUI.panel.state, "open", "Panel should have closed when the find bar opened"); - is(tooltip.state, "open", "The info panel should have remained open"); + ok(tooltip.state == "showing" || tooltip.state == "open", "The info panel should have remained open"); done(); }, "Highlight should have disappeared when panel closed"); }, "Highlight should be shown after showHighlight() for fixed panel items"); }, function test_highlight_info_panel_click_find(done) { gContentAPI.showHighlight("help"); gContentAPI.showInfo("customize", "customize me!", "awesome!"); @@ -103,17 +103,17 @@ let tests = [ isnot(PanelUI.panel.state, "closed", "Panel should have opened"); // Click the help button which should open the subview in the panel menu. let helpButton = document.getElementById("PanelUI-help"); EventUtils.synthesizeMouseAtCenter(helpButton, {}); waitForElementToBeHidden(highlight, function highlightHidden() { is(PanelUI.panel.state, "open", "Panel should have stayed open when the subview opened"); - is(tooltip.state, "open", "The info panel should have remained open"); + ok(tooltip.state == "showing" || tooltip.state == "open", "The info panel should have remained open"); PanelUI.hide(); done(); }, "Highlight should have disappeared when the subview opened"); }, "Highlight should be shown after showHighlight() for fixed panel items"); }, function test_info_panel_open_subview(done) { gContentAPI.showHighlight("urlbar");
--- a/browser/modules/test/head.js +++ b/browser/modules/test/head.js @@ -36,23 +36,39 @@ function is_hidden(element) { // Hiding a parent element will hide all its children if (element.parentNode != element.ownerDocument) return is_hidden(element.parentNode); return false; } +function is_visible(element) { + var style = element.ownerDocument.defaultView.getComputedStyle(element, ""); + if (style.display == "none") + return false; + if (style.visibility != "visible") + return false; + if (style.display == "-moz-popup" && element.state != "open") + return false; + + // Hiding a parent element will hide all its children + if (element.parentNode != element.ownerDocument) + return is_visible(element.parentNode); + + return true; +} + function is_element_visible(element, msg) { isnot(element, null, "Element should not be null, when checking visibility"); - ok(!is_hidden(element), msg); + ok(is_visible(element), msg); } function waitForElementToBeVisible(element, nextTest, msg) { - waitForCondition(() => !is_hidden(element), + waitForCondition(() => is_visible(element), () => { ok(true, msg); nextTest(); }, "Timeout waiting for visibility: " + msg); } function waitForElementToBeHidden(element, nextTest, msg) { @@ -60,17 +76,17 @@ function waitForElementToBeHidden(elemen () => { ok(true, msg); nextTest(); }, "Timeout waiting for invisibility: " + msg); } function waitForPopupAtAnchor(popup, anchorNode, nextTest, msg) { - waitForCondition(() => popup.popupBoxObject.anchorNode == anchorNode, + waitForCondition(() => is_visible(popup) && popup.popupBoxObject.anchorNode == anchorNode, () => { ok(true, msg); is_element_visible(popup, "Popup should be visible"); nextTest(); }, "Timeout waiting for popup at anchor: " + msg); }
--- a/content/base/src/nsGenericDOMDataNode.h +++ b/content/base/src/nsGenericDOMDataNode.h @@ -16,16 +16,17 @@ #include "nsTextFragment.h" #include "nsError.h" #include "mozilla/dom/Element.h" #include "nsCycleCollectionParticipant.h" #include "nsISMILAttr.h" #include "nsIDocument.h" +#include "mozilla/dom/ShadowRoot.h" class nsIDOMAttr; class nsIDOMEventListener; class nsIDOMNodeList; class nsIFrame; class nsIDOMText; class nsURI;
--- a/extensions/spellcheck/hunspell/src/moz.build +++ b/extensions/spellcheck/hunspell/src/moz.build @@ -27,23 +27,21 @@ if not CONFIG['MOZ_NATIVE_HUNSPELL']: ] # This variable is referenced in configure.in. Make sure to change that file # too if you need to change this variable. DEFINES['HUNSPELL_STATIC'] = True FINAL_LIBRARY = 'spellchecker' LOCAL_INCLUDES += [ + '/content/base/src', + '/editor/libeditor/base', '/extensions/spellcheck/src', ] -LOCAL_INCLUDES += [ - '/editor/libeditor/base', -] - # Suppress warnings in third-party code. if CONFIG['CLANG_CXX']: CXXFLAGS += ['-Wno-unused-private-field'] include('/ipc/chromium/chromium-config.mozbuild') IPDL_SOURCES = [ 'PRemoteSpellcheckEngine.ipdl',
--- a/gfx/layers/basic/TextureHostBasic.cpp +++ b/gfx/layers/basic/TextureHostBasic.cpp @@ -1,15 +1,17 @@ /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "TextureHostBasic.h" +#ifdef XP_MACOSX #include "MacIOSurfaceTextureHostBasic.h" +#endif using namespace mozilla::gl; using namespace mozilla::gfx; namespace mozilla { namespace layers { TemporaryRef<TextureHost>
--- a/gfx/layers/composite/X11TextureHost.h +++ b/gfx/layers/composite/X11TextureHost.h @@ -5,17 +5,17 @@ #ifndef MOZILLA_GFX_X11TEXTUREHOST__H #define MOZILLA_GFX_X11TEXTUREHOST__H #include "mozilla/layers/TextureHost.h" #include "mozilla/layers/LayersSurfaces.h" #include "mozilla/gfx/Types.h" -class gfxXlibSurface; +#include "gfxXlibSurface.h" namespace mozilla { namespace layers { // TextureHost for Xlib-backed TextureSources. class X11TextureHost : public TextureHost { public:
--- a/js/src/jit/MIR.cpp +++ b/js/src/jit/MIR.cpp @@ -3220,22 +3220,18 @@ MSqrt::trySpecializeFloat32(TempAllocato } MDefinition * MBoundsCheck::foldsTo(TempAllocator &alloc) { if (index()->isConstant() && length()->isConstant()) { uint32_t len = length()->toConstant()->value().toInt32(); uint32_t idx = index()->toConstant()->value().toInt32(); - if (idx + uint32_t(minimum()) < len && idx + uint32_t(maximum()) < len) { - // This bounds check will never fail, so we can clear the Guard flag - // and allow it to be deleted. - setNotGuard(); + if (idx + uint32_t(minimum()) < len && idx + uint32_t(maximum()) < len) return index(); - } } return this; } bool jit::ElementAccessIsDenseNative(MDefinition *obj, MDefinition *id) {
--- a/js/src/jit/ValueNumbering.cpp +++ b/js/src/jit/ValueNumbering.cpp @@ -474,36 +474,41 @@ ValueNumberer::visitDefinition(MDefiniti // If sim doesn't belong to a block, insert it next to def. if (sim->block() == nullptr) def->block()->insertAfter(def->toInstruction(), sim->toInstruction()); IonSpew(IonSpew_GVN, " Folded %s%u to %s%u", def->opName(), def->id(), sim->opName(), sim->id()); ReplaceAllUsesWith(def, sim); + + // The node's foldsTo said |def| can be replaced by |rep|. If |def| is a + // guard, then either |rep| is also a guard, or a guard isn't actually + // needed, so we can clear |def|'s guard flag and let it be deleted. + def->setNotGuardUnchecked(); + if (IsDead(def) && !deleteDefsRecursively(def)) return false; def = sim; } // Look for a dominating def which makes this def redundant. MDefinition *rep = leader(def); if (rep != def) { if (rep == nullptr) return false; if (rep->updateForReplacement(def)) { IonSpew(IonSpew_GVN, " Replacing %s%u with %s%u", def->opName(), def->id(), rep->opName(), rep->id()); ReplaceAllUsesWith(def, rep); - // This is effectively what the old GVN did. It allows isGuard() - // instructions to be deleted if they are redundant, and the - // replacement is not even guaranteed to have isGuard() set. - // TODO: Clean this up (bug 1031410). + // The node's congruentTo said |def| is congruent to |rep|, and it's + // dominated by |rep|. If |def| is a guard, it's covered by |rep|, + // so we can clear |def|'s guard flag and let it be deleted. def->setNotGuardUnchecked(); if (IsDead(def) && !deleteDefsRecursively(def)) return false; def = rep; } }
--- a/js/src/vm/Stack.cpp +++ b/js/src/vm/Stack.cpp @@ -1676,18 +1676,16 @@ void jit::JitActivation::markRematerializedFrames(JSTracer *trc) { if (!rematerializedFrames_) return; for (RematerializedFrameTable::Enum e(*rematerializedFrames_); !e.empty(); e.popFront()) RematerializedFrame::MarkInVector(trc, e.front().value()); } -#endif // JS_ION - AsmJSActivation::AsmJSActivation(JSContext *cx, AsmJSModule &module) : Activation(cx, AsmJS), module_(module), errorRejoinSP_(nullptr), profiler_(nullptr), resumePC_(nullptr), fp_(nullptr), exitReason_(AsmJSExit::None) @@ -1724,16 +1722,18 @@ AsmJSActivation::~AsmJSActivation() JSContext *cx = cx_->asJSContext(); JS_ASSERT(cx->mainThread().asmJSActivationStack_ == this); JSRuntime::AutoLockForInterrupt lock(cx->runtime()); cx->mainThread().asmJSActivationStack_ = prevAsmJS_; } +#endif // JS_ION + InterpreterFrameIterator & InterpreterFrameIterator::operator++() { JS_ASSERT(!done()); if (fp_ != activation_->entryFrame_) { pc_ = fp_->prevpc(); sp_ = fp_->prevsp(); fp_ = fp_->prev(); @@ -1777,69 +1777,101 @@ ActivationIterator::settle() // we don't iterate over an active jit activation. while (!done() && activation_->isJit() && !activation_->asJit()->isActive()) activation_ = activation_->prev(); } JS::ProfilingFrameIterator::ProfilingFrameIterator(JSRuntime *rt, const RegisterState &state) : activation_(rt->mainThread.asmJSActivationStack()) { +#ifdef JS_ION if (!activation_) return; static_assert(sizeof(AsmJSProfilingFrameIterator) <= StorageSpace, "Need to increase storage"); new (storage_.addr()) AsmJSProfilingFrameIterator(*activation_, state); settle(); +#else + JS_ASSERT(!activation_); +#endif } JS::ProfilingFrameIterator::~ProfilingFrameIterator() { +#ifdef JS_ION if (!done()) iter().~AsmJSProfilingFrameIterator(); +#else + JS_ASSERT(done()); +#endif } void JS::ProfilingFrameIterator::operator++() { +#ifdef JS_ION JS_ASSERT(!done()); ++iter(); settle(); +#else + MOZ_CRASH("Shouldn't have any frames"); +#endif } void JS::ProfilingFrameIterator::settle() { +#ifdef JS_ION while (iter().done()) { iter().~AsmJSProfilingFrameIterator(); activation_ = activation_->prevAsmJS(); if (!activation_) return; new (storage_.addr()) AsmJSProfilingFrameIterator(*activation_); } +#else + MOZ_CRASH("Shouldn't have any frames"); +#endif } JS::ProfilingFrameIterator::Kind JS::ProfilingFrameIterator::kind() const { +#ifdef JS_ION return iter().kind(); +#else + MOZ_CRASH("Shouldn't have any frames"); +#endif } JSAtom * JS::ProfilingFrameIterator::functionDisplayAtom() const { +#ifdef JS_ION JS_ASSERT(kind() == Function); return iter().functionDisplayAtom(); +#else + MOZ_CRASH("Shouldn't have any frames"); +#endif } const char * JS::ProfilingFrameIterator::functionFilename() const { +#ifdef JS_ION JS_ASSERT(kind() == Function); return iter().functionFilename(); +#else + MOZ_CRASH("Shouldn't have any frames"); +#endif } const char * JS::ProfilingFrameIterator::nonFunctionDescription() const { +#ifdef JS_ION JS_ASSERT(kind() != Function); return iter().nonFunctionDescription(); +#else + MOZ_CRASH("Shouldn't have any frames"); +#endif }
--- a/layout/base/crashtests/crashtests.list +++ b/layout/base/crashtests/crashtests.list @@ -40,17 +40,17 @@ load 265027-1.html load 265736-1.html load 265736-2.html load 265899-1.html load 265973-1.html asserts(6-12) load 265986-1.html # Bug 512405 load 265999-1.html load 266222-1.html asserts(1-7) load 266360-1.html # bug 576358 -load 266445-1.html +asserts(2) load 266445-1.html load 268157-1.html load 269566-1.html load 272647-1.html load 275746-1.html load 276053-1.html load 280708-1.html load 280708-2.html load 281333-1.html
--- a/layout/base/nsIPresShell.h +++ b/layout/base/nsIPresShell.h @@ -767,27 +767,27 @@ public: /** * Get the mMayHaveTouchCaret flag. */ virtual bool MayHaveTouchCaret() = 0; /** * Get the selection caret, if it exists. AddRefs it. */ - virtual NS_HIDDEN_(already_AddRefed<mozilla::SelectionCarets>) GetSelectionCarets() const = 0; + virtual already_AddRefed<mozilla::SelectionCarets> GetSelectionCarets() const = 0; /** * Returns the start part of selection caret element of the presshell. */ - virtual NS_HIDDEN_(mozilla::dom::Element*) GetSelectionCaretsStartElement() const = 0; + virtual mozilla::dom::Element* GetSelectionCaretsStartElement() const = 0; /** * Returns the end part of selection caret element of the presshell. */ - virtual NS_HIDDEN_(mozilla::dom::Element*) GetSelectionCaretsEndElement() const = 0; + virtual mozilla::dom::Element* GetSelectionCaretsEndElement() const = 0; /** * Get the caret, if it exists. AddRefs it. */ virtual already_AddRefed<nsCaret> GetCaret() const = 0; /** * Invalidate the caret's current position if it's outside of its frame's
--- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -3586,17 +3586,18 @@ GetPercentHeight(const nsStyleCoord& aSt } nscoord minh; if (GetAbsoluteCoord(pos->mMinHeight, minh) || GetPercentHeight(pos->mMinHeight, f, minh)) { if (minh > h) h = minh; } else { - NS_ASSERTION(pos->mMinHeight.HasPercent(), + NS_ASSERTION(pos->mMinHeight.HasPercent() || + pos->mMinHeight.GetUnit() == eStyleUnit_Auto, "unknown min-height unit"); } if (aStyle.IsCalcUnit()) { aResult = std::max(nsRuleNode::ComputeComputedCalc(aStyle, h), 0); return true; } @@ -3701,17 +3702,29 @@ nsLayoutUtils::IntrinsicForContainer(nsR // a content width less than zero // * that we prevent tables from becoming smaller than their // intrinsic minimum width nscoord result = 0, min = 0; nscoord maxw; bool haveFixedMaxWidth = GetAbsoluteCoord(styleMaxWidth, maxw); nscoord minw; - bool haveFixedMinWidth = GetAbsoluteCoord(styleMinWidth, minw); + + // Treat "min-width: auto" as 0. + bool haveFixedMinWidth; + if (eStyleUnit_Auto == styleMinWidth.GetUnit()) { + // NOTE: Technically, "auto" is supposed to behave like "min-content" on + // flex items. However, we don't need to worry about that here, because + // flex items' min-sizes are intentionally ignored until the flex + // container explicitly considers them during space distribution. + minw = 0; + haveFixedMinWidth = true; + } else { + haveFixedMinWidth = GetAbsoluteCoord(styleMinWidth, minw); + } // If we have a specified width (or a specified 'min-width' greater // than the specified 'max-width', which works out to the same thing), // don't even bother getting the frame's intrinsic width, because in // this case GetAbsoluteCoord(styleWidth, w) will always succeed, so // we'll never need the intrinsic dimensions. if (styleWidth.GetUnit() == eStyleUnit_Enumerated && (styleWidth.GetIntValue() == NS_STYLE_WIDTH_MAX_CONTENT || @@ -3735,22 +3748,28 @@ nsLayoutUtils::IntrinsicForContainer(nsR nsFrame::IndentBy(stderr, gNoiseIndent); static_cast<nsFrame*>(aFrame)->ListTag(stderr); printf_stderr(" %s intrinsic width from frame is %d.\n", aType == MIN_WIDTH ? "min" : "pref", result); #endif // Handle elements with an intrinsic ratio (or size) and a specified // height, min-height, or max-height. + // NOTE: We treat "min-height:auto" as "0" for the purpose of this code, + // since that's what it means in all cases except for on flex items -- and + // even there, we're supposed to ignore it (i.e. treat it as 0) until the + // flex container explicitly considers it. const nsStyleCoord &styleHeight = stylePos->mHeight; const nsStyleCoord &styleMinHeight = stylePos->mMinHeight; const nsStyleCoord &styleMaxHeight = stylePos->mMaxHeight; + if (styleHeight.GetUnit() != eStyleUnit_Auto || - !(styleMinHeight.GetUnit() == eStyleUnit_Coord && - styleMinHeight.GetCoordValue() == 0) || + !(styleMinHeight.GetUnit() == eStyleUnit_Auto || + (styleMinHeight.GetUnit() == eStyleUnit_Coord && + styleMinHeight.GetCoordValue() == 0)) || styleMaxHeight.GetUnit() != eStyleUnit_None) { nsSize ratio = aFrame->GetIntrinsicRatio(); if (ratio.height != 0) { nscoord heightTakenByBoxSizing = 0; switch (boxSizing) { case NS_STYLE_BOX_SIZING_BORDER: { @@ -4156,30 +4175,33 @@ nsLayoutUtils::ComputeSizeWithIntrinsicD } if (stylePos->mMaxWidth.GetUnit() != eStyleUnit_None && !(isFlexItem && isHorizontalFlexItem)) { maxWidth = nsLayoutUtils::ComputeWidthValue(aRenderingContext, aFrame, aCBSize.width, boxSizingAdjust.width, boxSizingToMarginEdgeWidth, stylePos->mMaxWidth); } else { - // NOTE: Flex items ignore their min & max sizing properties in their - // flex container's main-axis. (Those properties get applied later in - // the flexbox algorithm.) maxWidth = nscoord_MAX; } - if (!(isFlexItem && isHorizontalFlexItem)) { + // NOTE: Flex items ignore their min & max sizing properties in their + // flex container's main-axis. (Those properties get applied later in + // the flexbox algorithm.) + if (stylePos->mMinWidth.GetUnit() != eStyleUnit_Auto && + !(isFlexItem && isHorizontalFlexItem)) { minWidth = nsLayoutUtils::ComputeWidthValue(aRenderingContext, aFrame, aCBSize.width, boxSizingAdjust.width, boxSizingToMarginEdgeWidth, stylePos->mMinWidth); } else { - // NOTE: Flex items ignore their min & max sizing properties in their - // flex container's main-axis. (Those properties get applied later in - // the flexbox algorithm.) + // Treat "min-width: auto" as 0. + // NOTE: Technically, "auto" is supposed to behave like "min-content" on + // flex items. However, we don't need to worry about that here, because + // flex items' min-sizes are intentionally ignored until the flex + // container explicitly considers them during space distribution. minWidth = 0; } if (!isAutoHeight) { height = nsLayoutUtils::ComputeHeightValue(aCBSize.height, boxSizingAdjust.height, *heightStyleCoord); }
--- a/layout/base/nsPresShell.h +++ b/layout/base/nsPresShell.h @@ -219,19 +219,19 @@ public: virtual bool IsVisible() MOZ_OVERRIDE; // touch caret virtual already_AddRefed<mozilla::TouchCaret> GetTouchCaret() const MOZ_OVERRIDE; virtual mozilla::dom::Element* GetTouchCaretElement() const MOZ_OVERRIDE; virtual void SetMayHaveTouchCaret(bool aSet) MOZ_OVERRIDE; virtual bool MayHaveTouchCaret() MOZ_OVERRIDE; // selection caret - virtual NS_HIDDEN_(already_AddRefed<mozilla::SelectionCarets>) GetSelectionCarets() const MOZ_OVERRIDE; - virtual NS_HIDDEN_(mozilla::dom::Element*) GetSelectionCaretsStartElement() const MOZ_OVERRIDE; - virtual NS_HIDDEN_(mozilla::dom::Element*) GetSelectionCaretsEndElement() const MOZ_OVERRIDE; + virtual already_AddRefed<mozilla::SelectionCarets> GetSelectionCarets() const MOZ_OVERRIDE; + virtual mozilla::dom::Element* GetSelectionCaretsStartElement() const MOZ_OVERRIDE; + virtual mozilla::dom::Element* GetSelectionCaretsEndElement() const MOZ_OVERRIDE; // caret handling virtual already_AddRefed<nsCaret> GetCaret() const MOZ_OVERRIDE; virtual void MaybeInvalidateCaretPosition() MOZ_OVERRIDE; NS_IMETHOD SetCaretEnabled(bool aInEnable) MOZ_OVERRIDE; NS_IMETHOD SetCaretReadOnly(bool aReadOnly) MOZ_OVERRIDE; NS_IMETHOD GetCaretEnabled(bool *aOutEnabled) MOZ_OVERRIDE; NS_IMETHOD SetCaretVisibilityDuringSelection(bool aVisibility) MOZ_OVERRIDE; NS_IMETHOD GetCaretVisible(bool *_retval) MOZ_OVERRIDE;
new file mode 100644 --- /dev/null +++ b/layout/generic/crashtests/946167-1.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html> +<body> +<script> + // Create a bunch of nested flex containers: + var parentNode = document.body; + var depth = 50; + for (var i = 0; i < depth; i++) { + var childNode = document.createElement("div"); + childNode.style.display = "flex"; + parentNode.appendChild(childNode); + parentNode = childNode; + } + + // Add some text in the innermost child: + childNode.innerHTML = "Text"; + + // Force reflow: + var height = document.body.children[0].offsetHeight; +</script>
--- a/layout/generic/crashtests/crashtests.list +++ b/layout/generic/crashtests/crashtests.list @@ -526,16 +526,17 @@ asserts(1-4) load 876074-1.html # bug 87 load 885009-1.html load 893496-1.html load 893523.html test-pref(layout.css.sticky.enabled,true) load 914891.html test-pref(layout.css.sticky.enabled,true) load 915475.xhtml load 927558.html load 943509-1.html asserts(3-6) load 944909-1.html +load 946167-1.html test-pref(layout.css.sticky.enabled,true) load 949932.html load 973701-1.xhtml load 973701-2.xhtml load 986899.html load 1001233.html load 1001258-1.html pref(layout.css.grid.enabled,true) load 1015562.html asserts(1-2) load 1015563-1.html
--- a/layout/generic/nsFlexContainerFrame.cpp +++ b/layout/generic/nsFlexContainerFrame.cpp @@ -10,16 +10,17 @@ #include "nsFlexContainerFrame.h" #include "nsContentUtils.h" #include "nsCSSAnonBoxes.h" #include "nsDisplayList.h" #include "nsIFrameInlines.h" #include "nsLayoutUtils.h" #include "nsPlaceholderFrame.h" #include "nsPresContext.h" +#include "nsRenderingContext.h" #include "nsStyleContext.h" #include "prlog.h" #include <algorithm> #include "mozilla/LinkedList.h" using namespace mozilla; using namespace mozilla::layout; @@ -253,31 +254,34 @@ private: * Represents a flex item. * Includes the various pieces of input that the Flexbox Layout Algorithm uses * to resolve a flexible width. */ class nsFlexContainerFrame::FlexItem : public LinkedListElement<FlexItem> { public: // Normal constructor: - FlexItem(nsIFrame* aChildFrame, + FlexItem(nsHTMLReflowState& aFlexItemReflowState, float aFlexGrow, float aFlexShrink, nscoord aMainBaseSize, nscoord aMainMinSize, nscoord aMainMaxSize, nscoord aCrossMinSize, nscoord aCrossMaxSize, - nsMargin aMargin, nsMargin aBorderPadding, const FlexboxAxisTracker& aAxisTracker); // Simplified constructor, to be used only for generating "struts": FlexItem(nsIFrame* aChildFrame, nscoord aCrossSize); // Accessors nsIFrame* Frame() const { return mFrame; } nscoord GetFlexBaseSize() const { return mFlexBaseSize; } - nscoord GetMainMinSize() const { return mMainMinSize; } + nscoord GetMainMinSize() const { + MOZ_ASSERT(!mNeedsMinSizeAutoResolution, + "Someone's using an unresolved 'auto' main min-size"); + return mMainMinSize; + } nscoord GetMainMaxSize() const { return mMainMaxSize; } // Note: These return the main-axis position and size of our *content box*. nscoord GetMainSize() const { return mMainSize; } nscoord GetMainPosition() const { return mMainPosn; } nscoord GetCrossMinSize() const { return mCrossMinSize; } nscoord GetCrossMaxSize() const { return mCrossMaxSize; } @@ -318,16 +322,21 @@ public: // before its actual reflow. bool HadMeasuringReflow() const { return mHadMeasuringReflow; } // Indicates whether this item's cross-size has been stretched (from having // "align-self: stretch" with an auto cross-size and no auto margins in the // cross axis). bool IsStretched() const { return mIsStretched; } + // Indicates whether we need to resolve an 'auto' value for the main-axis + // min-[width|height] property. + bool NeedsMinSizeAutoResolution() const + { return mNeedsMinSizeAutoResolution; } + // Indicates whether this item is a "strut" left behind by an element with // visibility:collapse. bool IsStrut() const { return mIsStrut; } uint8_t GetAlignSelf() const { return mAlignSelf; } // Returns the flex factor (flex-grow or flex-shrink), depending on // 'aIsUsingFlexGrow'. @@ -413,16 +422,38 @@ public: // padding in the given axis nscoord GetMarginBorderPaddingSizeInAxis(AxisOrientationType aAxis) const { return GetMarginSizeInAxis(aAxis) + GetBorderPaddingSizeInAxis(aAxis); } // Setters // ======= + // Helper to set the resolved value of min-[width|height]:auto for the main + // axis. (Should only be used if NeedsMinSizeAutoResolution() returns true.) + void UpdateMainMinSize(nscoord aNewMinSize) + { + NS_ASSERTION(aNewMinSize >= 0, + "How did we end up with a negative min-size?"); + MOZ_ASSERT(mMainMaxSize >= aNewMinSize, + "Should only use this function for resolving min-size:auto, " + "and main max-size should be an upper-bound for resolved val"); + MOZ_ASSERT(mNeedsMinSizeAutoResolution && + (mMainMinSize == 0 || mFrame->IsThemed(mFrame->StyleDisplay())), + "Should only use this function for resolving min-size:auto, " + "so we shouldn't already have a nonzero min-size established " + "(unless it's a themed-widget-imposed minimum size)"); + + if (aNewMinSize > mMainMinSize) { + mMainMinSize = aNewMinSize; + // Also clamp main-size to be >= new min-size: + mMainSize = std::max(mMainSize, aNewMinSize); + } + mNeedsMinSizeAutoResolution = false; + } // This sets our flex base size, and then sets our main size to the // resulting "hypothetical main size" (the base size clamped to our // main-axis [min,max] sizing constraints). void SetFlexBaseSizeAndMainSize(nscoord aNewFlexBaseSize) { MOZ_ASSERT(!mIsFrozen || mFlexBaseSize == NS_INTRINSICSIZE, "flex base size shouldn't change after we're frozen " @@ -519,30 +550,37 @@ public: } void ResolveStretchedCrossSize(nscoord aLineCrossSize, const FlexboxAxisTracker& aAxisTracker); uint32_t GetNumAutoMarginsInAxis(AxisOrientationType aAxis) const; protected: + // Helper called by the constructor, to set mNeedsMinSizeAutoResolution: + void CheckForMinSizeAuto(const nsHTMLReflowState& aFlexItemReflowState, + const FlexboxAxisTracker& aAxisTracker); + // Our frame: nsIFrame* const mFrame; // Values that we already know in constructor: (and are hence mostly 'const') const float mFlexGrow; const float mFlexShrink; const nsMargin mBorderPadding; nsMargin mMargin; // non-const because we need to resolve auto margins + // These are non-const so that we can lazily update them with the item's + // intrinsic size (obtained via a "measuring" reflow), when necessary. + // (e.g. for "flex-basis:auto;height:auto" & "min-height:auto") nscoord mFlexBaseSize; - - const nscoord mMainMinSize; - const nscoord mMainMaxSize; + nscoord mMainMinSize; + nscoord mMainMaxSize; + const nscoord mCrossMinSize; const nscoord mCrossMaxSize; // Values that we compute after constructor: nscoord mMainSize; nscoord mMainPosn; nscoord mCrossSize; nscoord mCrossPosn; @@ -559,16 +597,20 @@ protected: bool mHadMaxViolation; // Misc: bool mHadMeasuringReflow; // Did this item get a preliminary reflow, // to measure its desired height? bool mIsStretched; // See IsStretched() documentation bool mIsStrut; // Is this item a "strut" left behind by an element // with visibility:collapse? + + // Does this item need to resolve a min-[width|height]:auto (in main-axis). + bool mNeedsMinSizeAutoResolution; + uint8_t mAlignSelf; // My "align-self" computed value (with "auto" // swapped out for parent"s "align-items" value, // in our constructor). }; /** * Represents a single flex line in a flex container. * Manages a linked list of the FlexItems that are in the line. @@ -994,100 +1036,370 @@ nsFlexContainerFrame::GenerateFlexItemFo mainMaxSize = std::max(mainMaxSize, widgetMainMinSize); crossMinSize = std::max(crossMinSize, widgetCrossMinSize); crossMaxSize = std::max(crossMaxSize, widgetCrossMinSize); } } // Construct the flex item! - FlexItem* item = new FlexItem(aChildFrame, + FlexItem* item = new FlexItem(childRS, flexGrow, flexShrink, flexBaseSize, mainMinSize, mainMaxSize, crossMinSize, crossMaxSize, - childRS.ComputedPhysicalMargin(), - childRS.ComputedPhysicalBorderPadding(), aAxisTracker); // If we're inflexible, we can just freeze to our hypothetical main-size // up-front. Similarly, if we're a fixed-size widget, we only have one // valid size, so we freeze to keep ourselves from flexing. if (isFixedSizeWidget || (flexGrow == 0.0f && flexShrink == 0.0f)) { item->Freeze(); } + // Resolve "flex-basis:auto" and/or "min-[width|height]:auto" (which might + // require us to reflow the item to measure content height) + ResolveAutoFlexBasisAndMinSize(aPresContext, *item, + childRS, aAxisTracker); return item; } +// Static helper-functions for ResolveAutoFlexBasisAndMinSize(): +// ------------------------------------------------------------- +// Indicates whether the cross-size property is set to something definite. +// The logic here should be similar to the logic for isAutoWidth/isAutoHeight +// in nsLayoutUtils::ComputeSizeWithIntrinsicDimensions(). +static bool +IsCrossSizeDefinite(const nsHTMLReflowState& aItemReflowState, + const FlexboxAxisTracker& aAxisTracker) +{ + const nsStylePosition* pos = aItemReflowState.mStylePosition; + if (IsAxisHorizontal(aAxisTracker.GetCrossAxis())) { + return pos->mWidth.GetUnit() != eStyleUnit_Auto; + } + // else, vertical. (We need to use IsAutoHeight() to catch e.g. %-height + // applied to indefinite-height containing block, which counts as auto.) + nscoord cbHeight = aItemReflowState.mCBReflowState->ComputedHeight(); + return !nsLayoutUtils::IsAutoHeight(pos->mHeight, cbHeight); +} + +// If aFlexItem has a definite cross size, this function returns it, for usage +// (in combination with an intrinsic ratio) for resolving the item's main size +// or main min-size. +// +// The parameter "aMinSizeFallback" indicates whether we should fall back to +// returning the cross min-size, when the cross size is indefinite. (This param +// should be set IFF the caller intends to resolve the main min-size.) If this +// param is true, then this function is guaranteed to return a definite value +// (i.e. not NS_AUTOHEIGHT, excluding cases where huge sizes are involved). +// +// XXXdholbert the min-size behavior here is based on my understanding in +// http://lists.w3.org/Archives/Public/www-style/2014Jul/0053.html +// If my understanding there ends up being wrong, we'll need to update this. +static nscoord +CrossSizeToUseWithRatio(const FlexItem& aFlexItem, + const nsHTMLReflowState& aItemReflowState, + bool aMinSizeFallback, + const FlexboxAxisTracker& aAxisTracker) +{ + if (aFlexItem.IsStretched()) { + // Definite cross-size, imposed via 'align-self:stretch' & flex container. + return aFlexItem.GetCrossSize(); + } + + if (IsCrossSizeDefinite(aItemReflowState, aAxisTracker)) { + // Definite cross size. + return GET_CROSS_COMPONENT(aAxisTracker, + aItemReflowState.ComputedWidth(), + aItemReflowState.ComputedHeight()); + } + + if (aMinSizeFallback) { + // Indefinite cross-size, and we're resolving main min-size, so we'll fall + // back to ussing the cross min-size (which should be definite). + return GET_CROSS_COMPONENT(aAxisTracker, + aItemReflowState.ComputedMinWidth(), + aItemReflowState.ComputedMinHeight()); + } + + // Indefinite cross-size. + return NS_AUTOHEIGHT; +} + +// XXX This macro shamelessly stolen from nsLayoutUtils.cpp. +// (Maybe it should be exposed via a nsLayoutUtils method?) +#define MULDIV(a,b,c) (nscoord(int64_t(a) * int64_t(b) / int64_t(c))) + +// Convenience function; returns a main-size, given a cross-size and an +// intrinsic ratio. The intrinsic ratio must not have 0 in its cross-axis +// component (or else we'll divide by 0). +static nscoord +MainSizeFromAspectRatio(nscoord aCrossSize, + const nsSize& aIntrinsicRatio, + const FlexboxAxisTracker& aAxisTracker) +{ + MOZ_ASSERT(aAxisTracker.GetCrossComponent(aIntrinsicRatio) != 0, + "Invalid ratio; will divide by 0! Caller should've checked..."); + + if (IsAxisHorizontal(aAxisTracker.GetCrossAxis())) { + // cross axis horiz --> aCrossSize is a width. Converting to height. + return MULDIV(aCrossSize, aIntrinsicRatio.height, aIntrinsicRatio.width); + } + // cross axis vert --> aCrossSize is a height. Converting to width. + return MULDIV(aCrossSize, aIntrinsicRatio.width, aIntrinsicRatio.height); +} + +// Partially resolves "min-[width|height]:auto" and returns the resulting value. +// By "partially", I mean we don't consider the min-content size (but we do +// consider flex-basis, main max-size, and the intrinsic aspect ratio). +// The caller is responsible for computing & considering the min-content size +// in combination with the partially-resolved value that this function returns. +// +// Spec reference: http://dev.w3.org/csswg/css-flexbox/#min-size-auto +static nscoord +PartiallyResolveAutoMinSize(const FlexItem& aFlexItem, + const nsHTMLReflowState& aItemReflowState, + const nsSize& aIntrinsicRatio, + const FlexboxAxisTracker& aAxisTracker) +{ + MOZ_ASSERT(aFlexItem.NeedsMinSizeAutoResolution(), + "only call for FlexItems that need min-size auto resolution"); + + nscoord minMainSize = nscoord_MAX; // Intentionally huge; we'll shrink it + // from here, w/ std::min(). + + // We need the smallest of: + // * the used flex-basis, if the computed flex-basis was 'auto': + // XXXdholbert ('auto' might be renamed to 'main-size'; see bug 1032922) + if (eStyleUnit_Auto == + aItemReflowState.mStylePosition->mFlexBasis.GetUnit() && + aFlexItem.GetFlexBaseSize() != NS_AUTOHEIGHT) { + // NOTE: We skip this if the flex base size depends on content & isn't yet + // resolved. This is OK, because the caller is responsible for computing + // the min-content height and min()'ing it with the value we return, which + // is equivalent to what would happen if we min()'d that at this point. + minMainSize = std::min(minMainSize, aFlexItem.GetFlexBaseSize()); + } + + // * the computed max-width (max-height), if that value is definite: + nscoord maxSize = + GET_MAIN_COMPONENT(aAxisTracker, + aItemReflowState.ComputedMaxWidth(), + aItemReflowState.ComputedMaxHeight()); + if (maxSize != NS_UNCONSTRAINEDSIZE) { + minMainSize = std::min(minMainSize, maxSize); + } + + // * if the item has no intrinsic aspect ratio, its min-content size: + // --- SKIPPING THIS IN THIS FUNCTION --- caller's responsibility. + + // * if the item has an intrinsic aspect ratio, the width (height) calculated + // from the aspect ratio and any definite size constraints in the opposite + // dimension. + if (aAxisTracker.GetCrossComponent(aIntrinsicRatio) != 0) { + // We have a usable aspect ratio. (not going to divide by 0) + const bool useMinSizeIfCrossSizeIsIndefinite = true; + nscoord crossSizeToUseWithRatio = + CrossSizeToUseWithRatio(aFlexItem, aItemReflowState, + useMinSizeIfCrossSizeIsIndefinite, + aAxisTracker); + nscoord minMainSizeFromRatio = + MainSizeFromAspectRatio(crossSizeToUseWithRatio, + aIntrinsicRatio, aAxisTracker); + minMainSize = std::min(minMainSize, minMainSizeFromRatio); + } + + return minMainSize; +} + +// Resolves flex-basis:auto, using the given intrinsic ratio and the flex +// item's cross size. On success, updates the flex item with its resolved +// flex-basis and returns true. On failure (e.g. if the ratio is invalid or +// the cross-size is indefinite), returns false. +static bool +ResolveAutoFlexBasisFromRatio(FlexItem& aFlexItem, + const nsHTMLReflowState& aItemReflowState, + const nsSize& aIntrinsicRatio, + const FlexboxAxisTracker& aAxisTracker) +{ + MOZ_ASSERT(NS_AUTOHEIGHT == aFlexItem.GetFlexBaseSize(), + "Should only be called to resolve an 'auto' flex-basis"); + // If the flex item has ... + // - an intrinsic aspect ratio, + // - a [used] flex-basis of 'main-size' [auto?] [We have this, if we're here.] + // - a definite cross size + // then the flex base size is calculated from its inner cross size and the + // flex item’s intrinsic aspect ratio. + if (aAxisTracker.GetCrossComponent(aIntrinsicRatio) != 0) { + // We have a usable aspect ratio. (not going to divide by 0) + const bool useMinSizeIfCrossSizeIsIndefinite = false; + nscoord crossSizeToUseWithRatio = + CrossSizeToUseWithRatio(aFlexItem, aItemReflowState, + useMinSizeIfCrossSizeIsIndefinite, + aAxisTracker); + if (crossSizeToUseWithRatio != NS_AUTOHEIGHT) { + // We have a definite cross-size + nscoord mainSizeFromRatio = + MainSizeFromAspectRatio(crossSizeToUseWithRatio, + aIntrinsicRatio, aAxisTracker); + aFlexItem.SetFlexBaseSizeAndMainSize(mainSizeFromRatio); + return true; + } + } + return false; +} + +// Note: If & when we handle "min-height: min-content" for flex items, +// we may want to resolve that in this function, too. void nsFlexContainerFrame:: - ResolveFlexItemMaxContentSizing(nsPresContext* aPresContext, - FlexItem& aFlexItem, - const nsHTMLReflowState& aParentReflowState, - const FlexboxAxisTracker& aAxisTracker) + ResolveAutoFlexBasisAndMinSize(nsPresContext* aPresContext, + FlexItem& aFlexItem, + const nsHTMLReflowState& aItemReflowState, + const FlexboxAxisTracker& aAxisTracker) { - if (IsAxisHorizontal(aAxisTracker.GetMainAxis())) { - // Nothing to do -- this function is only for measuring flex items - // in a vertical flex container. + // (Note: We should never have a used flex-basis of "auto" if our main axis + // is horizontal; width values should always be resolvable without reflow.) + const bool isMainSizeAuto = (!IsAxisHorizontal(aAxisTracker.GetMainAxis()) && + NS_AUTOHEIGHT == aFlexItem.GetFlexBaseSize()); + + const bool isMainMinSizeAuto = aFlexItem.NeedsMinSizeAutoResolution(); + + if (!isMainSizeAuto && !isMainMinSizeAuto) { + // Nothing to do; this function is only needed for flex items + // with a used flex-basis of "auto" or a min-main-size of "auto". return; } - if (NS_AUTOHEIGHT != aFlexItem.GetFlexBaseSize()) { - // Nothing to do; this function's only relevant for flex items - // with a base size of "auto" (or equivalent). - // XXXdholbert If & when we handle "min-height: min-content" for flex items, - // we'll want to resolve that in this function, too. - return; + // We may be about to do computations based on our item's cross-size + // (e.g. using it as a contstraint when measuring our content in the + // main axis, or using it with the intrinsic ratio to obtain a main size). + // BEFORE WE DO THAT, we need let the item "pre-stretch" its cross size (if + // it's got 'align-self:stretch'), for a certain case where the spec says + // the stretched cross size is considered "definite". That case is if we + // have a single-line (nowrap) flex container which itself has a definite + // cross-size. Otherwise, we'll wait to do stretching, since (in other + // cases) we don't know how much the item should stretch yet. + const nsHTMLReflowState* flexContainerRS = aItemReflowState.parentReflowState; + MOZ_ASSERT(flexContainerRS, + "flex item's reflow state should have ptr to container's state"); + if (NS_STYLE_FLEX_WRAP_NOWRAP == flexContainerRS->mStylePosition->mFlexWrap) { + // XXXdholbert Maybe this should share logic with ComputeCrossSize()... + // Alternately, maybe tentative container cross size should be passed down. + nscoord containerCrossSize = + GET_CROSS_COMPONENT(aAxisTracker, + flexContainerRS->ComputedWidth(), + flexContainerRS->ComputedHeight()); + // Is container's cross size "definite"? + // (Container's cross size is definite if cross-axis is horizontal, or if + // cross-axis is vertical and the cross-size is not NS_AUTOHEIGHT.) + if (IsAxisHorizontal(aAxisTracker.GetCrossAxis()) || + containerCrossSize != NS_AUTOHEIGHT) { + aFlexItem.ResolveStretchedCrossSize(containerCrossSize, aAxisTracker); + } + } + + // We'll need the intrinsic ratio (if there is one), regardless of whether + // we're resolving min-[width|height]:auto or flex-basis:auto. + const nsSize ratio = aFlexItem.Frame()->GetIntrinsicRatio(); + + nscoord resolvedMinSize; // (only set/used if isMainMinSizeAuto==true) + bool minSizeNeedsToMeasureContent = false; // assume the best + if (isMainMinSizeAuto) { + // Resolve the min-size, except for considering the min-content size. + // (We'll consider that later, if we need to.) + resolvedMinSize = PartiallyResolveAutoMinSize(aFlexItem, aItemReflowState, + ratio, aAxisTracker); + if (resolvedMinSize > 0 && + aAxisTracker.GetCrossComponent(ratio) == 0) { + // We don't have a usable aspect ratio, so we need to consider our + // min-content size as another candidate min-size, which we'll have to + // min() with the current resolvedMinSize. + // (If resolvedMinSize were already at 0, we could skip this measurement + // because it can't go any lower. But it's not 0, so we need it.) + minSizeNeedsToMeasureContent = true; + } } - // If we get here, we're vertical and our main size ended up being - // unconstrained. We need to use our "max-content" height, which is what we - // get from reflowing into our available width. - // Note: This has to come *after* we construct the FlexItem, since we - // invoke at least one convenience method (ResolveStretchedCrossSize) which - // requires a FlexItem. - - // Give the item a special reflow with "mIsFlexContainerMeasuringHeight" - // set. This tells it to behave as if it had "height: auto", regardless - // of what the "height" property is actually set to. + bool flexBasisNeedsToMeasureContent = false; // assume the best + if (isMainSizeAuto) { + if (!ResolveAutoFlexBasisFromRatio(aFlexItem, aItemReflowState, + ratio, aAxisTracker)) { + flexBasisNeedsToMeasureContent = true; + } + } + + // Measure content, if needed (w/ intrinsic-width method or a reflow) + if (minSizeNeedsToMeasureContent || flexBasisNeedsToMeasureContent) { + if (IsAxisHorizontal(aAxisTracker.GetMainAxis())) { + nsRefPtr<nsRenderingContext> rctx = + aPresContext->PresShell()->CreateReferenceRenderingContext(); + if (minSizeNeedsToMeasureContent) { + resolvedMinSize = std::min(resolvedMinSize, aFlexItem.Frame()->GetMinWidth(rctx)); + } + NS_ASSERTION(!flexBasisNeedsToMeasureContent, + "flex-basis:auto should have been resolved in the " + "reflow state, for horizontal flexbox. It shouldn't need " + "special handling here"); + } else { + // If this item is flexible (vertically), or if we're measuring the + // 'auto' min-height and our main-size is something else, then we assume + // that the computed-height we're reflowing with now could be different + // from the one we'll use for this flex item's "actual" reflow later on. + // In that case, we need to be sure the flex item treats this as a + // vertical resize, even though none of its ancestors are necessarily + // being vertically resized. + // (Note: We don't have to do this for width, because InitResizeFlags + // will always turn on mHResize on when it sees that the computed width + // is different from current width, and that's all we need.) + bool forceVerticalResizeForMeasuringReflow = + !aFlexItem.IsFrozen() || // Is the item flexible? + !flexBasisNeedsToMeasureContent; // Are we *only* measuring it for + // 'min-height:auto'? + + nscoord contentHeight = + MeasureFlexItemContentHeight(aPresContext, aFlexItem, + forceVerticalResizeForMeasuringReflow, + *flexContainerRS); + if (minSizeNeedsToMeasureContent) { + resolvedMinSize = std::min(resolvedMinSize, contentHeight); + } + if (flexBasisNeedsToMeasureContent) { + aFlexItem.SetFlexBaseSizeAndMainSize(contentHeight); + } + } + } + + if (isMainMinSizeAuto) { + aFlexItem.UpdateMainMinSize(resolvedMinSize); + } +} + +nscoord +nsFlexContainerFrame:: + MeasureFlexItemContentHeight(nsPresContext* aPresContext, + FlexItem& aFlexItem, + bool aForceVerticalResizeForMeasuringReflow, + const nsHTMLReflowState& aParentReflowState) +{ + // Set up a reflow state for measuring the flex item's auto-height: nsHTMLReflowState childRSForMeasuringHeight(aPresContext, aParentReflowState, aFlexItem.Frame(), nsSize(aParentReflowState.ComputedWidth(), NS_UNCONSTRAINEDSIZE), -1, -1, nsHTMLReflowState::CALLER_WILL_INIT); childRSForMeasuringHeight.mFlags.mIsFlexContainerMeasuringHeight = true; childRSForMeasuringHeight.Init(aPresContext); - // For single-line vertical flexbox, we need to give our flex items an early - // opportunity to stretch, since any stretching of their cross-size (width) - // will likely impact the max-content main-size (height) that we're about to - // measure for them. (We can't do this for multi-line, since we don't know - // yet how many lines there will be & how much each line will stretch.) - if (NS_STYLE_FLEX_WRAP_NOWRAP == - aParentReflowState.mStylePosition->mFlexWrap) { - aFlexItem.ResolveStretchedCrossSize(aParentReflowState.ComputedWidth(), - aAxisTracker); - } - if (aFlexItem.IsStretched()) { childRSForMeasuringHeight.SetComputedWidth(aFlexItem.GetCrossSize()); childRSForMeasuringHeight.mFlags.mHResize = true; } - // If this item is flexible (vertically), then we assume that the - // computed-height we're reflowing with now could be different - // from the one we'll use for this flex item's "actual" reflow later on. - // In that case, we need to be sure the flex item treats this as a - // vertical resize, even though none of its ancestors are necessarily - // being vertically resized. - // (Note: We don't have to do this for width, because InitResizeFlags - // will always turn on mHResize on when it sees that the computed width - // is different from current width, and that's all we need.) - if (!aFlexItem.IsFrozen()) { // Are we flexible? + if (aForceVerticalResizeForMeasuringReflow) { childRSForMeasuringHeight.mFlags.mVResize = true; } nsHTMLReflowMetrics childDesiredSize(childRSForMeasuringHeight); nsReflowStatus childReflowStatus; const uint32_t flags = NS_FRAME_NO_MOVE_FRAME; ReflowChild(aFlexItem.Frame(), aPresContext, childDesiredSize, childRSForMeasuringHeight, @@ -1096,67 +1408,69 @@ nsFlexContainerFrame:: MOZ_ASSERT(NS_FRAME_IS_COMPLETE(childReflowStatus), "We gave flex item unconstrained available height, so it " "should be complete"); FinishReflowChild(aFlexItem.Frame(), aPresContext, childDesiredSize, &childRSForMeasuringHeight, 0, 0, flags); + aFlexItem.SetHadMeasuringReflow(); + // Subtract border/padding in vertical axis, to get _just_ // the effective computed value of the "height" property. nscoord childDesiredHeight = childDesiredSize.Height() - childRSForMeasuringHeight.ComputedPhysicalBorderPadding().TopBottom(); - childDesiredHeight = std::max(0, childDesiredHeight); - - aFlexItem.SetFlexBaseSizeAndMainSize(childDesiredHeight); - aFlexItem.SetHadMeasuringReflow(); + + return std::max(0, childDesiredHeight); } -FlexItem::FlexItem(nsIFrame* aChildFrame, +FlexItem::FlexItem(nsHTMLReflowState& aFlexItemReflowState, float aFlexGrow, float aFlexShrink, nscoord aFlexBaseSize, nscoord aMainMinSize, nscoord aMainMaxSize, nscoord aCrossMinSize, nscoord aCrossMaxSize, - nsMargin aMargin, nsMargin aBorderPadding, const FlexboxAxisTracker& aAxisTracker) - : mFrame(aChildFrame), + : mFrame(aFlexItemReflowState.frame), mFlexGrow(aFlexGrow), mFlexShrink(aFlexShrink), - mBorderPadding(aBorderPadding), - mMargin(aMargin), + mBorderPadding(aFlexItemReflowState.ComputedPhysicalBorderPadding()), + mMargin(aFlexItemReflowState.ComputedPhysicalMargin()), mMainMinSize(aMainMinSize), mMainMaxSize(aMainMaxSize), mCrossMinSize(aCrossMinSize), mCrossMaxSize(aCrossMaxSize), mMainPosn(0), mCrossSize(0), mCrossPosn(0), mAscent(0), mShareOfWeightSoFar(0.0f), mIsFrozen(false), mHadMinViolation(false), mHadMaxViolation(false), mHadMeasuringReflow(false), mIsStretched(false), mIsStrut(false), - mAlignSelf(aChildFrame->StylePosition()->mAlignSelf) + // mNeedsMinSizeAutoResolution is initialized in CheckForMinSizeAuto() + mAlignSelf(aFlexItemReflowState.mStylePosition->mAlignSelf) { MOZ_ASSERT(mFrame, "expecting a non-null child frame"); MOZ_ASSERT(mFrame->GetType() != nsGkAtoms::placeholderFrame, "placeholder frames should not be treated as flex items"); MOZ_ASSERT(!(mFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW), "out-of-flow frames should not be treated as flex items"); SetFlexBaseSizeAndMainSize(aFlexBaseSize); + CheckForMinSizeAuto(aFlexItemReflowState, aAxisTracker); // Assert that any "auto" margin components are set to 0. // (We'll resolve them later; until then, we want to treat them as 0-sized.) #ifdef DEBUG { - const nsStyleSides& styleMargin = mFrame->StyleMargin()->mMargin; + const nsStyleSides& styleMargin = + aFlexItemReflowState.mStyleMargin->mMargin; NS_FOR_CSS_SIDES(side) { if (styleMargin.GetUnit(side) == eStyleUnit_Auto) { MOZ_ASSERT(GetMarginComponentForSide(side) == 0, "Someone else tried to resolve our auto margin"); } } } #endif // DEBUG @@ -1204,28 +1518,53 @@ FlexItem::FlexItem(nsIFrame* aChildFrame mAscent(0), mShareOfWeightSoFar(0.0f), mIsFrozen(true), mHadMinViolation(false), mHadMaxViolation(false), mHadMeasuringReflow(false), mIsStretched(false), mIsStrut(true), // (this is the constructor for making struts, after all) + mNeedsMinSizeAutoResolution(false), mAlignSelf(NS_STYLE_ALIGN_ITEMS_FLEX_START) { MOZ_ASSERT(mFrame, "expecting a non-null child frame"); MOZ_ASSERT(NS_STYLE_VISIBILITY_COLLAPSE == mFrame->StyleVisibility()->mVisible, "Should only make struts for children with 'visibility:collapse'"); MOZ_ASSERT(mFrame->GetType() != nsGkAtoms::placeholderFrame, "placeholder frames should not be treated as flex items"); MOZ_ASSERT(!(mFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW), "out-of-flow frames should not be treated as flex items"); } +void +FlexItem::CheckForMinSizeAuto(const nsHTMLReflowState& aFlexItemReflowState, + const FlexboxAxisTracker& aAxisTracker) +{ + const nsStylePosition* pos = aFlexItemReflowState.mStylePosition; + const nsStyleDisplay* disp = aFlexItemReflowState.mStyleDisplay; + + // We'll need special behavior for "min-[width|height]:auto" (whichever is in + // the main axis) iff: + // (a) its computed value is "auto" + // (b) the "overflow" sub-property in the same axis (the main axis) has a + // computed value of "visible" + const nsStyleCoord& minSize = GET_MAIN_COMPONENT(aAxisTracker, + pos->mMinWidth, + pos->mMinHeight); + + const uint8_t overflowVal = GET_MAIN_COMPONENT(aAxisTracker, + disp->mOverflowX, + disp->mOverflowY); + + mNeedsMinSizeAutoResolution = (minSize.GetUnit() == eStyleUnit_Auto && + overflowVal == NS_STYLE_OVERFLOW_VISIBLE); +} + nscoord FlexItem::GetBaselineOffsetFromOuterCrossEdge(AxisOrientationType aCrossAxis, AxisEdgeType aEdge) const { // NOTE: Currently, 'mAscent' (taken from reflow) is an inherently vertical // measurement -- it's the distance from the border-top edge of this FlexItem // to its baseline. So, we can really only do baseline alignment when the // cross axis is vertical. (The FlexItem constructor enforces this when @@ -2659,19 +2998,16 @@ nsFlexContainerFrame::GenerateFlexLines( aStruts[nextStrutIdx].mItemIdx == itemIdxInContainer) { // Use the simplified "strut" FlexItem constructor: item = new FlexItem(childFrame, aStruts[nextStrutIdx].mStrutCrossSize); nextStrutIdx++; } else { item = GenerateFlexItemForChild(aPresContext, childFrame, aReflowState, aAxisTracker); - - ResolveFlexItemMaxContentSizing(aPresContext, *item, - aReflowState, aAxisTracker); } nscoord itemInnerHypotheticalMainSize = item->GetMainSize(); nscoord itemOuterHypotheticalMainSize = item->GetOuterMainSize(aAxisTracker.GetMainAxis()); // Check if we need to wrap |item| to a new line // (i.e. check if its outer hypothetical main size pushes our line over
--- a/layout/generic/nsFlexContainerFrame.h +++ b/layout/generic/nsFlexContainerFrame.h @@ -101,27 +101,52 @@ protected: template<bool IsLessThanOrEqual(nsIFrame*, nsIFrame*)> bool SortChildrenIfNeeded(); // Protected flex-container-specific methods / member-vars #ifdef DEBUG void SanityCheckAnonymousFlexItems() const; #endif // DEBUG - // Returns a new FlexItem for the given child frame, allocated on the heap. - // Caller is responsible for managing the FlexItem's lifetime. + /* + * Returns a new FlexItem for the given child frame, allocated on the heap. + * Guaranteed to return non-null. Caller is responsible for managing the + * FlexItem's lifetime. + * + * Before returning, this method also processes the FlexItem to resolve its + * flex basis (including e.g. auto-height) as well as to resolve + * "min-height:auto", via ResolveAutoFlexBasisAndMinSize(). (Basically, the + * returned FlexItem will be ready to participate in the "Resolve the + * Flexible Lengths" step of the Flex Layout Algorithm.) + */ FlexItem* GenerateFlexItemForChild(nsPresContext* aPresContext, nsIFrame* aChildFrame, const nsHTMLReflowState& aParentReflowState, const FlexboxAxisTracker& aAxisTracker); - void ResolveFlexItemMaxContentSizing(nsPresContext* aPresContext, + /** + * This method performs a "measuring" reflow to get the content height of + * aFlexItem.Frame() (treating it as if it had auto-height), & returns the + * resulting height. + * (Helper for ResolveAutoFlexBasisAndMinSize().) + */ + nscoord MeasureFlexItemContentHeight(nsPresContext* aPresContext, FlexItem& aFlexItem, - const nsHTMLReflowState& aParentReflowState, - const FlexboxAxisTracker& aAxisTracker); + bool aForceVerticalResizeForMeasuringReflow, + const nsHTMLReflowState& aParentReflowState); + + /** + * This method resolves an "auto" flex-basis and/or min-main-size value + * on aFlexItem, if needed. + * (Helper for GenerateFlexItemForChild().) + */ + void ResolveAutoFlexBasisAndMinSize(nsPresContext* aPresContext, + FlexItem& aFlexItem, + const nsHTMLReflowState& aItemReflowState, + const FlexboxAxisTracker& aAxisTracker); // Creates FlexItems for all of our child frames, arranged in a list of // FlexLines. These are returned by reference in |aLines|. Our actual // return value has to be |nsresult|, in case we have to reflow a child // to establish its flex base size and that reflow fails. void GenerateFlexLines(nsPresContext* aPresContext, const nsHTMLReflowState& aReflowState, nscoord aContentBoxMainSize,
--- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -4097,22 +4097,28 @@ nsFrame::ComputeSize(nsRenderingContext nscoord maxWidth = nsLayoutUtils::ComputeWidthValue(aRenderingContext, this, aCBSize.width, boxSizingAdjust.width, boxSizingToMarginEdgeWidth, stylePos->mMaxWidth); result.width = std::min(maxWidth, result.width); } nscoord minWidth; - if (!(isFlexItem && isHorizontalFlexItem)) { + if (stylePos->mMinWidth.GetUnit() != eStyleUnit_Auto && + !(isFlexItem && isHorizontalFlexItem)) { minWidth = nsLayoutUtils::ComputeWidthValue(aRenderingContext, this, aCBSize.width, boxSizingAdjust.width, boxSizingToMarginEdgeWidth, stylePos->mMinWidth); } else { + // Treat "min-width: auto" as 0. + // NOTE: Technically, "auto" is supposed to behave like "min-content" on + // flex items. However, we don't need to worry about that here, because + // flex items' min-sizes are intentionally ignored until the flex + // container explicitly considers them during space distribution. minWidth = 0; } result.width = std::max(minWidth, result.width); // Compute height // (but not if we're auto-height or if we recieved the "eUseAutoHeight" // flag -- then, we'll just stick with the height that we already calculated // in the initial ComputeAutoSize() call.)
--- a/layout/generic/nsHTMLReflowState.cpp +++ b/layout/generic/nsHTMLReflowState.cpp @@ -2590,19 +2590,26 @@ nsCSSOffsetState::ComputePadding(nscoord return isCBDependent; } void nsHTMLReflowState::ComputeMinMaxValues(nscoord aContainingBlockWidth, nscoord aContainingBlockHeight, const nsHTMLReflowState* aContainingBlockRS) { - ComputedMinWidth() = ComputeWidthValue(aContainingBlockWidth, - mStylePosition->mBoxSizing, - mStylePosition->mMinWidth); + // NOTE: min-width:auto resolves to 0, except on a flex item. (But + // even there, it's supposed to be ignored (i.e. treated as 0) until + // the flex container explicitly resolves & considers it.) + if (eStyleUnit_Auto == mStylePosition->mMinWidth.GetUnit()) { + ComputedMinWidth() = 0; + } else { + ComputedMinWidth() = ComputeWidthValue(aContainingBlockWidth, + mStylePosition->mBoxSizing, + mStylePosition->mMinWidth); + } if (eStyleUnit_None == mStylePosition->mMaxWidth.GetUnit()) { // Specified value of 'none' ComputedMaxWidth() = NS_UNCONSTRAINEDSIZE; // no limit } else { ComputedMaxWidth() = ComputeWidthValue(aContainingBlockWidth, mStylePosition->mBoxSizing, mStylePosition->mMaxWidth); @@ -2616,18 +2623,22 @@ nsHTMLReflowState::ComputeMinMaxValues(n // Check for percentage based values and a containing block height that // depends on the content height. Treat them like 'auto' // Likewise, check for calc() with percentages on internal table elements; // that's treated as 'auto' too. // Likewise, if we're a child of a flex container who's measuring our // intrinsic height, then we want to disregard our min-height. + // NOTE: min-height:auto resolves to 0, except on a flex item. (But + // even there, it's supposed to be ignored (i.e. treated as 0) until + // the flex container explicitly resolves & considers it.) const nsStyleCoord &minHeight = mStylePosition->mMinHeight; - if ((NS_AUTOHEIGHT == aContainingBlockHeight && + if (eStyleUnit_Auto == minHeight.GetUnit() || + (NS_AUTOHEIGHT == aContainingBlockHeight && minHeight.HasPercent()) || (mFrameType == NS_CSS_FRAME_TYPE_INTERNAL_TABLE && minHeight.IsCalcUnit() && minHeight.CalcHasPercent()) || mFlags.mIsFlexContainerMeasuringHeight) { ComputedMinHeight() = 0; } else { ComputedMinHeight() = ComputeHeightValue(aContainingBlockHeight, mStylePosition->mBoxSizing,
--- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -14,17 +14,17 @@ == 9458-zorder-1.html 9458-zorder-ref.html == 9458-zorder-2.html 9458-zorder-ref.html == 9458-zorder-3.html 9458-zorder-ref-inline.html == 9458-zorder-4.html 9458-zorder-ref-inline-block.html == 9458-zorder-5.html 9458-zorder-ref-inline-block.html == 10036-1.html 10036-1-ref.html skip-if(!cocoaWidget) HTTP(..) == 10209-1.html 10209-ref.html # Bug 667079 HTTP(..) == 10209-2.html 10209-ref.html -asserts(4) skip-if(!cocoaWidget) HTTP(..) == 10209-3.html 10209-3-ref.html # Assertions: bug 666606, skip because of bug 667079 +asserts(2) skip-if(!cocoaWidget) HTTP(..) == 10209-3.html 10209-3-ref.html # Assertions: bug 666606, skip because of bug 667079 == 18217-basic-1.html 18217-basic-1-ref.html == 18217-basic-2a.html 18217-basic-2-ref.html == 18217-basic-2b.html 18217-basic-2-ref.html == 18217-valign-1.html 18217-valign-1-ref.html == 18217-height-1.html 18217-height-1-ref.html == 18217-height-2.html 18217-height-2-ref.html == 18217-width-1a.html 18217-width-1-ref.html == 18217-width-1b.html 18217-width-1-ref.html
deleted file mode 100644 --- a/layout/reftests/flexbox/flexbox-basic-canvas-horiz-2-ref.xhtml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ ---> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <style> - div.flexbox { - height: 50px; - width: 50px; - border: 2px dotted black; - display: flex; - } - canvas { - width: 50px; - height: 50px; - background: purple; - min-width: -moz-min-content; - } - </style> - </head> - <body> - <div class="flexbox"> - <canvas/> - </div> - </body> -</html>
deleted file mode 100644 --- a/layout/reftests/flexbox/flexbox-basic-canvas-horiz-2.xhtml +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ ---> -<!-- - This test checks that a canvas element with "min-width: min-content" - and a huge specified "width" ends up being shrinkable. (In particular, - the large "width" value shouldn't influence the min-content width). ---> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <style> - div.flexbox { - height: 50px; - width: 50px; - border: 2px dotted black; - display: flex; - } - canvas { - width: 1000px; - height: 50px; - background: purple; - min-width: -moz-min-content; - } - </style> - </head> - <body> - <div class="flexbox"> - <canvas/> - </div> - </body> -</html>
deleted file mode 100644 --- a/layout/reftests/flexbox/flexbox-basic-canvas-vert-2-ref.xhtml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ ---> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <style> - div.flexbox { - height: 50px; - width: 50px; - border: 2px dotted black; - display: flex; - flex-direction: column; - } - canvas { - width: 50px; - height: 50px; - background: purple; - /* min-height: min-content isn't supported yet (bug 852367), but we'd - like this to work when it is supported. */ - min-height: -moz-min-content; - } - </style> - </head> - <body> - <div class="flexbox"> - <canvas/> - </div> - </body> -</html>
deleted file mode 100644 --- a/layout/reftests/flexbox/flexbox-basic-canvas-vert-2.xhtml +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ ---> -<!-- - This test checks that a canvas element with "min-height: min-content" - and a huge specified "height" ends up being shrinkable. (In particular, - the large "height" value shouldn't influence the min-content height). ---> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <style> - div.flexbox { - height: 50px; - width: 50px; - border: 2px dotted black; - display: flex; - flex-direction: column; - } - canvas { - width: 50px; - height: 1000px; - background: purple; - /* min-height: min-content isn't supported yet (bug 852367), but we'd - like this to work when it is supported. */ - min-height: -moz-min-content; - } - </style> - </head> - <body> - <div class="flexbox"> - <canvas/> - </div> - </body> -</html>
deleted file mode 100644 --- a/layout/reftests/flexbox/flexbox-basic-fieldset-horiz-2-ref.xhtml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ ---> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <style> - div.flexbox { - height: 50px; - width: 50px; - border: 2px dotted black; - display: flex; - } - fieldset { - width: 50px; - height: 50px; - background: purple; - border: 1px dotted green; - min-width: -moz-min-content; - } - </style> - </head> - <body> - <div class="flexbox"> - <fieldset/> - </div> - </body> -</html>
deleted file mode 100644 --- a/layout/reftests/flexbox/flexbox-basic-fieldset-horiz-2.xhtml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ ---> -<!-- - This test checks that a fieldset element with "min-width: min-content" - and a huge specified "width" ends up being shrinkable. (In particular, - the large "width" value shouldn't influence the min-content width). ---> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <style> - div.flexbox { - height: 50px; - width: 50px; - border: 2px dotted black; - display: flex; - } - fieldset { - width: 1000px; - height: 50px; - background: purple; - border: 1px dotted green; - min-width: -moz-min-content; - } - </style> - </head> - <body> - <div class="flexbox"> - <fieldset/> - </div> - </body> -</html>
deleted file mode 100644 --- a/layout/reftests/flexbox/flexbox-basic-fieldset-vert-2-ref.xhtml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ ---> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <style> - div.flexbox { - height: 50px; - width: 50px; - border: 2px dotted black; - display: flex; - flex-direction: column; - } - fieldset { - width: 50px; - height: 50px; - background: purple; - border: 1px dotted green; - /* min-height: min-content isn't supported yet (bug 852367), but we'd - like this to work when it is supported. */ - min-height: -moz-min-content; - } - </style> - </head> - <body> - <div class="flexbox"> - <fieldset/> - </div> - </body> -</html>
deleted file mode 100644 --- a/layout/reftests/flexbox/flexbox-basic-fieldset-vert-2.xhtml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ ---> -<!-- - This test checks that a fieldset element with "min-height: min-content" - and a huge specified "height" ends up being shrinkable. (In particular, - the large "height" value shouldn't influence the min-content height). ---> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <style> - div.flexbox { - height: 50px; - width: 50px; - border: 2px dotted black; - display: flex; - flex-direction: column; - } - fieldset { - width: 50px; - height: 1000px; - background: purple; - border: 1px dotted green; - /* min-height: min-content isn't supported yet (bug 852367), but we'd - like this to work when it is supported. */ - min-height: -moz-min-content; - } - </style> - </head> - <body> - <div class="flexbox"> - <fieldset/> - </div> - </body> -</html>
deleted file mode 100644 --- a/layout/reftests/flexbox/flexbox-basic-iframe-horiz-2-ref.xhtml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ ---> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <style> - div.flexbox { - height: 50px; - width: 50px; - border: 2px dotted black; - display: flex; - } - iframe { - width: 50px; - height: 50px; - background: purple; - min-width: -moz-min-content; - } - </style> - </head> - <body> - <div class="flexbox"> - <iframe/> - </div> - </body> -</html>
deleted file mode 100644 --- a/layout/reftests/flexbox/flexbox-basic-iframe-horiz-2.xhtml +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ ---> -<!-- - This test checks that an iframe element with "min-width: min-content" - and a huge specified "width" ends up being shrinkable. (In particular, - the large "width" value shouldn't influence the min-content width). ---> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <style> - div.flexbox { - height: 50px; - width: 50px; - border: 2px dotted black; - display: flex; - } - iframe { - width: 1000px; - height: 50px; - background: purple; - min-width: -moz-min-content; - } - </style> - </head> - <body> - <div class="flexbox"> - <iframe/> - </div> - </body> -</html>
deleted file mode 100644 --- a/layout/reftests/flexbox/flexbox-basic-iframe-vert-2-ref.xhtml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ ---> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <style> - div.flexbox { - height: 50px; - width: 50px; - border: 2px dotted black; - display: flex; - flex-direction: column; - } - iframe { - width: 50px; - height: 50px; - background: purple; - /* min-height: min-content isn't supported yet (bug 852367), but we'd - like this to work when it is supported. */ - min-height: -moz-min-content; - } - </style> - </head> - <body> - <div class="flexbox"> - <iframe/> - </div> - </body> -</html>
deleted file mode 100644 --- a/layout/reftests/flexbox/flexbox-basic-iframe-vert-2.xhtml +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ ---> -<!-- - This test checks that an iframe element with "min-height: min-content" - and a huge specified "height" ends up being shrinkable. (In particular, - the large "height" value shouldn't influence the min-content height). ---> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <style> - div.flexbox { - height: 50px; - width: 50px; - border: 2px dotted black; - display: flex; - flex-direction: column; - } - iframe { - width: 50px; - height: 1000px; - background: purple; - /* min-height: min-content isn't supported yet (bug 852367), but we'd - like this to work when it is supported. */ - min-height: -moz-min-content; - } - </style> - </head> - <body> - <div class="flexbox"> - <iframe/> - </div> - </body> -</html>
deleted file mode 100644 --- a/layout/reftests/flexbox/flexbox-basic-img-horiz-2-ref.xhtml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ ---> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <style> - div.flexbox { - height: 50px; - width: 50px; - border: 2px dotted black; - display: flex; - } - img { - width: 50px; - height: 50px; - background: purple; - min-width: -moz-min-content; - } - </style> - </head> - <body> - <div class="flexbox"> - <img src="solidblue.png"/> - </div> - </body> -</html>
deleted file mode 100644 --- a/layout/reftests/flexbox/flexbox-basic-img-horiz-2.xhtml +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ ---> -<!-- - This test checks that an img element with "min-width: min-content" - and a huge specified "width" ends up being shrinkable. (In particular, - the large "width" value shouldn't influence the min-content width). ---> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <style> - div.flexbox { - height: 50px; - width: 50px; - border: 2px dotted black; - display: flex; - } - img { - width: 1000px; - height: 50px; - background: purple; - min-width: -moz-min-content; - } - </style> - </head> - <body> - <div class="flexbox"> - <img src="solidblue.png"/> - </div> - </body> -</html>
deleted file mode 100644 --- a/layout/reftests/flexbox/flexbox-basic-img-vert-2-ref.xhtml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ ---> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <style> - div.flexbox { - height: 50px; - width: 50px; - border: 2px dotted black; - display: flex; - flex-direction: column; - } - img { - width: 50px; - height: 50px; - background: purple; - /* min-height: min-content isn't supported yet (bug 852367), but we'd - like this to work when it is supported. */ - min-height: -moz-min-content; - } - </style> - </head> - <body> - <div class="flexbox"> - <img src="solidblue.png"/> - </div> - </body> -</html>
deleted file mode 100644 --- a/layout/reftests/flexbox/flexbox-basic-img-vert-2.xhtml +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ ---> -<!-- - This test checks that an img element with "min-height: min-content" - and a huge specified "height" ends up being shrinkable. (In particular, - the large "height" value shouldn't influence the min-content height). ---> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <style> - div.flexbox { - height: 50px; - width: 50px; - border: 2px dotted black; - display: flex; - flex-direction: column; - } - img { - width: 50px; - height: 1000px; - background: purple; - /* min-height: min-content isn't supported yet (bug 852367), but we'd - like this to work when it is supported. */ - min-height: -moz-min-content; - } - </style> - </head> - <body> - <div class="flexbox"> - <img src="solidblue.png"/> - </div> - </body> -</html>
deleted file mode 100644 --- a/layout/reftests/flexbox/flexbox-basic-textarea-horiz-2-ref.xhtml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ ---> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <style> - div.flexbox { - height: 50px; - width: 50px; - border: 2px dotted black; - display: flex; - } - textarea { - width: 50px; - height: 50px; - background: purple; - border: 1px dotted green; - min-width: -moz-min-content; - } - </style> - </head> - <body> - <div class="flexbox"> - <textarea/> - </div> - </body> -</html>
deleted file mode 100644 --- a/layout/reftests/flexbox/flexbox-basic-textarea-horiz-2.xhtml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ ---> -<!-- - This test checks that a textarea element with "min-width: min-content" - and a huge specified "width" ends up being shrinkable. (In particular, - the large "width" value shouldn't influence the min-content width). ---> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <style> - div.flexbox { - height: 50px; - width: 50px; - border: 2px dotted black; - display: flex; - } - textarea { - width: 1000px; - height: 50px; - background: purple; - border: 1px dotted green; - min-width: -moz-min-content; - } - </style> - </head> - <body> - <div class="flexbox"> - <textarea/> - </div> - </body> -</html>
deleted file mode 100644 --- a/layout/reftests/flexbox/flexbox-basic-textarea-vert-2-ref.xhtml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ ---> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <style> - div.flexbox { - height: 50px; - width: 50px; - border: 2px dotted black; - display: flex; - flex-direction: column; - } - textarea { - width: 50px; - height: 50px; - background: purple; - border: 1px dotted green; - /* min-height: min-content isn't supported yet (bug 852367), but we'd - like this to work when it is supported. */ - min-height: -moz-min-content; - } - </style> - </head> - <body> - <div class="flexbox"> - <textarea/> - </div> - </body> -</html>
deleted file mode 100644 --- a/layout/reftests/flexbox/flexbox-basic-textarea-vert-2.xhtml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ ---> -<!-- - This test checks that a textarea element with "min-height: min-content" - and a huge specified "height" ends up being shrinkable. (In particular, - the large "height" value shouldn't influence the min-content height). ---> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <style> - div.flexbox { - height: 50px; - width: 50px; - border: 2px dotted black; - display: flex; - flex-direction: column; - } - textarea { - width: 50px; - height: 1000px; - background: purple; - border: 1px dotted green; - /* min-height: min-content isn't supported yet (bug 852367), but we'd - like this to work when it is supported. */ - min-height: -moz-min-content; - } - </style> - </head> - <body> - <div class="flexbox"> - <textarea/> - </div> - </body> -</html>
deleted file mode 100644 --- a/layout/reftests/flexbox/flexbox-basic-video-horiz-2-ref.xhtml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ ---> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <style> - div.flexbox { - height: 50px; - width: 50px; - border: 2px dotted black; - display: flex; - } - video { - width: 50px; - height: 50px; - background: purple; - min-width: -moz-min-content; - } - </style> - </head> - <body> - <div class="flexbox"> - <video/> - </div> - </body> -</html>
deleted file mode 100644 --- a/layout/reftests/flexbox/flexbox-basic-video-horiz-2.xhtml +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ ---> -<!-- - This test checks that a video element with "min-width: min-content" - and a huge specified "width" ends up being shrinkable. (In particular, - the large "width" value shouldn't influence the min-content width). ---> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <style> - div.flexbox { - height: 50px; - width: 50px; - border: 2px dotted black; - display: flex; - } - video { - width: 1000px; - height: 50px; - background: purple; - min-width: -moz-min-content; - } - </style> - </head> - <body> - <div class="flexbox"> - <video/> - </div> - </body> -</html>
deleted file mode 100644 --- a/layout/reftests/flexbox/flexbox-basic-video-vert-2-ref.xhtml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ ---> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <style> - div.flexbox { - height: 50px; - width: 50px; - border: 2px dotted black; - display: flex; - flex-direction: column; - } - video { - width: 50px; - height: 50px; - background: purple; - /* min-height: min-content isn't supported yet (bug 852367), but we'd - like this to work when it is supported. */ - min-height: -moz-min-content; - } - </style> - </head> - <body> - <div class="flexbox"> - <video/> - </div> - </body> -</html>
deleted file mode 100644 --- a/layout/reftests/flexbox/flexbox-basic-video-vert-2.xhtml +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ ---> -<!-- - This test checks that a video element with "min-height: min-content" - and a huge specified "height" ends up being shrinkable. (In particular, - the large "height" value shouldn't influence the min-content height). ---> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <style> - div.flexbox { - height: 50px; - width: 50px; - border: 2px dotted black; - display: flex; - flex-direction: column; - } - video { - width: 50px; - height: 1000px; - background: purple; - /* min-height: min-content isn't supported yet (bug 852367), but we'd - like this to work when it is supported. */ - min-height: -moz-min-content; - } - </style> - </head> - <body> - <div class="flexbox"> - <video/> - </div> - </body> -</html>
deleted file mode 100644 --- a/layout/reftests/flexbox/flexbox-minSize-horiz-1-ref.xhtml +++ /dev/null @@ -1,78 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ ---> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <style> - div.flexbox { - width: 200px; - font-size: 8px; - } - div.outerContainer { - border: 1px dotted black; - height: 42px; - margin-bottom: 5px; - } - div.flexbox > * { - vertical-align: top; - display: inline-block; - margin-right: 20px; - border: 1px dashed green; - background: lightblue; - height: 40px; - } - div.childMinSizeIsMinContent > * { - min-width: -moz-min-content; - } - div.childSizeIsMinContent > * { - width: -moz-min-content; - } - div.smallSize { width: 5px; } - div.smallFlexBasis { width: 2px; } - div.zeroWidth { width: 0; } - - </style> - </head> - <body> - - <!-- Check that we use the min-content width as a lower-bound when sizing - flex items. --> - <div class="flexbox childMinSizeIsMinContent outerContainer"> - <div>abc d e f</div - ><div class="smallSize">abc d e f</div - ><div class="smallFlexBasis">abc d e f</div> - </div> - - <!-- ... EVEN if our flex container is small and we're overflowing. --> - <div class="outerContainer smallSize"> - <div class="flexbox childSizeIsMinContent"> - <div>abc d e f</div - ><div>abc d e f</div - ><div>abc d e f</div> - </div> - </div> - - <!-- Test that "min-width: 0" on flex items will keep us from clamping to - the min-content width. (So we can now actually honor small 'width' - and 'flex-basis' values.) --> - <div class="flexbox outerContainer"> - <div>abc d e f</div - ><div class="smallSize">abc d e f</div - ><div class="smallFlexBasis">abc d e f</div> - </div> - - <!-- ... and similarly, when we have a small flex container and we trigger - shrinking behavior, flex items with "min-width: 0" are allowed to - shrink past their min-content width. --> - <div class="outerContainer smallSize"> - <div class="flexbox"> - <div class="zeroWidth">abc d e f</div - ><div class="zeroWidth">abc d e f</div - ><div class="zeroWidth">abc d e f</div> - </div> - </div> - - </body> -</html>
deleted file mode 100644 --- a/layout/reftests/flexbox/flexbox-minSize-horiz-1.xhtml +++ /dev/null @@ -1,71 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ ---> -<!-- - This test checks that we correctly handle flex items with an explicit - "min-width: -moz-min-content". - - We check that such flex items can't shrink below their min-content width, - unless we explicitly reduce their min-width with e.g. "min-width: 0". ---> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <style> - div.flexbox { - width: 200px; - display: flex; - margin-bottom: 5px; - font-size: 8px; - border: 1px dotted black; - } - div.flexbox > * { - margin-right: 20px; - border: 1px dashed green; - background: lightblue; - height: 40px; - min-width: -moz-min-content; - } - div.smallSize { width: 5px; } - div.smallFlexBasis { flex-basis: 2px; } - div.zeroMinWidth { min-width: 0; } - - </style> - </head> - <body> - - <!-- Check that we honor "min-width: min-content" as a lower-bound when - sizing flex items. --> - <div class="flexbox"> - <div>abc d e f</div> - <div class="smallSize">abc d e f</div> - <div class="smallFlexBasis">abc d e f</div> - </div> - - <!-- ... EVEN if our flex container is small and we're overflowing. --> - <div class="flexbox smallSize"> - <div>abc d e f</div> - <div class="smallSize">abc d e f</div> - <div class="smallFlexBasis">abc d e f</div> - </div> - - <!-- Test that we don't clamp when we've got "min-width: 0" on our - flex items, though. --> - <div class="flexbox"> - <div class="zeroMinWidth">abc d e f</div> - <div class="zeroMinWidth smallSize">abc d e f</div> - <div class="zeroMinWidth smallFlexBasis">abc d e f</div> - </div> - - <!-- ... and similarly, when we have a small flex container and we trigger - shrinking behavior, flex items with "min-width: 0" are allowed to - shrink past their min-content width. --> - <div class="flexbox smallSize"> - <div class="zeroMinWidth">abc d e f</div> - <div class="zeroMinWidth smallSize">abc d e f</div> - <div class="zeroMinWidth smallFlexBasis">abc d e f</div> - </div> - - </body> -</html>
deleted file mode 100644 --- a/layout/reftests/flexbox/flexbox-minSize-vert-1-ref.xhtml +++ /dev/null @@ -1,55 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ ---> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <style> - div.flexbox { - height: 140px; - margin-right: 5px; - font-size: 8px; - border: 1px dotted black; - float: left; - } - div.flexbox > * { - margin-bottom: 20px; - border: 1px dashed green; - background: lightblue; - width: 40px; - } - div.smallSize { height: 5px; } - div.smallFlexBasis { height: 2px; } - div.zeroHeight { height: 0; } - - </style> - </head> - <body> - - <div class="flexbox"> - <div>a b</div> - <div>a b</div> - <div>a b</div> - </div> - - <div class="flexbox smallSize"> - <div>a b</div> - <div>a b</div> - <div>a b</div> - </div> - - <div class="flexbox"> - <div>a b</div> - <div class="smallSize">a b</div> - <div class="smallFlexBasis">a b</div> - </div> - - <div class="flexbox smallSize"> - <div class="zeroHeight">a b</div> - <div class="zeroHeight">a b</div> - <div class="zeroHeight">a b</div> - </div> - - </body> -</html>
deleted file mode 100644 --- a/layout/reftests/flexbox/flexbox-minSize-vert-1.xhtml +++ /dev/null @@ -1,73 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ ---> -<!-- - This test checks that we correctly handle flex items with an explicit - "min-height: -moz-min-content". - - We check that such flex items can't shrink below their min-content height, - unless we explicitly reduce their min-height with e.g. "min-height: 0". ---> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <style> - div.flexbox { - height: 140px; - display: flex; - flex-direction: column; - margin-right: 5px; - font-size: 8px; - border: 1px dotted black; - float: left; - } - div.flexbox > * { - margin-bottom: 20px; - border: 1px dashed green; - background: lightblue; - width: 40px; - min-height: -moz-min-content; /* not yet supported -- see bug 852367 */ - } - div.smallSize { height: 5px; } - div.smallFlexBasis { flex-basis: 2px; } - div.zeroMinHeight { min-height: 0; } - - </style> - </head> - <body> - - <!-- Check that we honor "min-height: min-content" as a lower-bound when - sizing flex items. --> - <div class="flexbox"> - <div>a b</div> - <div class="smallSize">a b</div> - <div class="smallFlexBasis">a b</div> - </div> - - <!-- ... EVEN if our flex container is small and we're overflowing. --> - <div class="flexbox smallSize"> - <div>a b</div> - <div class="smallSize">a b</div> - <div class="smallFlexBasis">a b</div> - </div> - - <!-- Test that we don't clamp when we've got "min-height: 0" on our - flex items, though. --> - <div class="flexbox"> - <div class="zeroMinHeight">a b</div> - <div class="zeroMinHeight smallSize">a b</div> - <div class="zeroMinHeight smallFlexBasis">a b</div> - </div> - - <!-- ... and similarly, when we have a small flex container and we trigger - shrinking behavior, flex items with "min-height: 0" are allowed to - shrink past their min-content height. --> - <div class="flexbox smallSize"> - <div class="zeroMinHeight">a b</div> - <div class="zeroMinHeight smallSize">a b</div> - <div class="zeroMinHeight smallFlexBasis">a b</div> - </div> - - </body> -</html>
--- a/layout/reftests/flexbox/flexbox-widget-flex-items-3.html +++ b/layout/reftests/flexbox/flexbox-widget-flex-items-3.html @@ -17,16 +17,17 @@ align-items: flex-start; background: lightgray; width: 400px; height: 40px; margin-bottom: 10px; } div.flexbox > * { max-width: 3px; + min-width: 0; /* to override default 'min-width:auto' */ outline: 1px dashed black; margin: 0; vertical-align: top; } </style> </head> <body> <div class="flexbox"><input type="button"></div>
--- a/layout/reftests/flexbox/reftest.list +++ b/layout/reftests/flexbox/reftest.list @@ -14,44 +14,16 @@ include pagination/reftest.list # Tests for cross-axis alignment (align-self / align-items properties) fails == flexbox-align-self-baseline-horiz-2.xhtml flexbox-align-self-baseline-horiz-2-ref.xhtml # bug 793456, and possibly others # This one fails on windows R (but not Ru, strangely). On Windows R, the # single-line <label> flex item has a different background size in test vs. ref fuzzy-if(B2G,10,3) random-if(winWidget) == flexbox-align-self-baseline-horiz-3.xhtml flexbox-align-self-baseline-horiz-3-ref.xhtml # XXXdholbert investigate == flexbox-align-self-baseline-horiz-4.xhtml flexbox-align-self-baseline-horiz-4-ref.xhtml -# Tests for basic handling of <canvas>/<img>/etc as a flex item -# NOTE: The "-1" versions of these tests have moved to the w3c-css directory; -# the -2 variants remain behind, because they explicitly intend to test -# how e.g. "min-width: -moz-min-content" affects the rendering, and we don't -# want to upload tests with prefixed keywords to the W3C testsuite. - -== flexbox-basic-canvas-horiz-2.xhtml flexbox-basic-canvas-horiz-2-ref.xhtml -# NOTE: This test will only test something useful once we add support for -# "min-height: -moz-min-content", bug 852367. At that point, it will probably -# fail until bug 794660 is fixed: -== flexbox-basic-canvas-vert-2.xhtml flexbox-basic-canvas-vert-2-ref.xhtml -== flexbox-basic-fieldset-horiz-2.xhtml flexbox-basic-fieldset-horiz-2-ref.xhtml -== flexbox-basic-fieldset-vert-2.xhtml flexbox-basic-fieldset-vert-2-ref.xhtml -== flexbox-basic-iframe-horiz-2.xhtml flexbox-basic-iframe-horiz-2-ref.xhtml -== flexbox-basic-iframe-vert-2.xhtml flexbox-basic-iframe-vert-2-ref.xhtml -== flexbox-basic-img-horiz-2.xhtml flexbox-basic-img-horiz-2-ref.xhtml -# NOTE: This test will only test something useful once we add support for -# "min-height: -moz-min-content", bug 852367. At that point, it will probably -# fail until bug 794660 is fixed: -== flexbox-basic-img-vert-2.xhtml flexbox-basic-img-vert-2-ref.xhtml -== flexbox-basic-textarea-horiz-2.xhtml flexbox-basic-textarea-horiz-2-ref.xhtml -== flexbox-basic-textarea-vert-2.xhtml flexbox-basic-textarea-vert-2-ref.xhtml -== flexbox-basic-video-horiz-2.xhtml flexbox-basic-video-horiz-2-ref.xhtml -# NOTE: This test will only test something useful once we add support for -# "min-height: -moz-min-content", bug 852367. At that point, it will probably -# fail until bug 794660 is fixed: -== flexbox-basic-video-vert-2.xhtml flexbox-basic-video-vert-2-ref.xhtml - # Tests for box-sizing on flex containers and flex items. == flexbox-box-sizing-on-container-horiz-1.html flexbox-box-sizing-on-container-horiz-1-ref.html == flexbox-box-sizing-on-container-vert-1.html flexbox-box-sizing-on-container-vert-1-ref.html == flexbox-box-sizing-on-items-horiz-1a.html flexbox-box-sizing-on-items-horiz-1-ref.html == flexbox-box-sizing-on-items-horiz-1b.html flexbox-box-sizing-on-items-horiz-1-ref.html == flexbox-box-sizing-on-items-vert-1a.html flexbox-box-sizing-on-items-vert-1-ref.html == flexbox-box-sizing-on-items-vert-1b.html flexbox-box-sizing-on-items-vert-1-ref.html @@ -88,20 +60,16 @@ fuzzy-if(B2G,10,3) random-if(winWidget) # Tests for handling of floated elements inside a flexbox == flexbox-float-1a.xhtml flexbox-float-1-ref.xhtml == flexbox-float-1b.xhtml flexbox-float-1-ref.xhtml == flexbox-float-1c.xhtml flexbox-float-1-ref.xhtml == flexbox-float-1d.xhtml flexbox-float-1-ref.xhtml == flexbox-float-2a.xhtml flexbox-float-2-ref.xhtml == flexbox-float-2b.xhtml flexbox-float-2-ref.xhtml -# Tests for "min-width" and "min-height" on flex items. -== flexbox-minSize-horiz-1.xhtml flexbox-minSize-horiz-1-ref.xhtml -fails == flexbox-minSize-vert-1.xhtml flexbox-minSize-vert-1-ref.xhtml # bug 852367 - # Tests for the order in which we paint flex items fails == flexbox-paint-ordering-3.html flexbox-paint-ordering-3-ref.html # bug 874718 # Tests for handling of absolutely/fixed/relatively-positioned flex items. == flexbox-position-absolute-1.xhtml flexbox-position-absolute-1-ref.xhtml == flexbox-position-absolute-2.xhtml flexbox-position-absolute-2-ref.xhtml == flexbox-position-absolute-3.xhtml flexbox-position-absolute-3-ref.xhtml == flexbox-position-absolute-4.xhtml flexbox-position-absolute-4-ref.xhtml
--- a/layout/reftests/w3c-css/submitted/flexbox/flexbox-flex-flow-1.html +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-flex-flow-1.html @@ -19,16 +19,22 @@ background: yellow; float: left; border: 1px solid black; } .flexContainer > * { border: 1px dotted gray; width: 28px; height: 28px; + /* Explicitly set min-width & min-height to 0, to prevent their "auto" + value from influencing the sizes of our flex items (particularly for + the single-line chunks of this testcase, whose items may be shrunk a + little below the numerals' intrinsic sizes): */ + min-width: 0; + min-height: 0; } </style> </head> <body> <!-- single-line (flex-wrap unspecified): --> <div class="flexContainer" style="flex-flow: row"> <div>1</div><div>2</div><div>3</div><div>4</div> </div>
--- a/layout/reftests/w3c-css/submitted/flexbox/flexbox-flex-flow-2.html +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-flex-flow-2.html @@ -19,16 +19,22 @@ background: yellow; float: left; border: 1px solid black; } .flexContainer > * { border: 1px dotted gray; width: 28px; height: 28px; + /* Explicitly set min-width & min-height to 0, to prevent their "auto" + value from influencing the sizes of our flex items (particularly for + the single-line chunks of this testcase, whose items may be shrunk a + little below the numerals' intrinsic sizes): */ + min-width: 0; + min-height: 0; } </style> </head> <body> <!-- single-line (flex-wrap unspecified): --> <div class="flexContainer" style="flex-flow: row"> <div>1</div><div>2</div><div>3</div> </div>
new file mode 100644 --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-min-height-auto-001-ref.html @@ -0,0 +1,42 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Reftest Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + .item { + /* Flex items have purple border: */ + border: 2px dotted purple; + margin-right: 2px; /* (Just for spacing things out, visually) */ + float: left; + } + + .small { height: 50px; } + .big { height: 80px; } + + .item > * { + /* Flex items' contents are gray & fixed-size: */ + background: gray; + width: 10px; + height: 80px; + } + </style> + </head> + <body> + <div class="item small"><div></div></div> + <div class="item small"><div></div></div> + <div class="item small"><div></div></div> + <div class="item small"><div></div></div> + <div class="item small"><div></div></div> + <div class="item small"><div></div></div> + + <div class="item big"><div></div></div> + <div class="item big"><div></div></div> + <div class="item big"><div></div></div> + </body> +</html>
new file mode 100644 --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-min-height-auto-001.html @@ -0,0 +1,102 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: Testing min-height:auto</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="http://www.w3.org/TR/css3-flexbox/#min-size-auto"> + <link rel="match" href="flexbox-min-height-auto-001-ref.html"> +<!-- + This testcase tests the used value of "min-height:auto" (the property's + initial value) on flex items in a vertical flex container. + + It's supposed to resolve to the smallest of: + a) The used 'flex-basis' (taken from 'height'), if 'flex-basis' is at its + initial value. + b) The computed 'max-height' property + c) If there's no intrinsic aspect ratio: the item's min-content height. + d) If there is an intrinsic aspect ratio: the item's height derived from + the ratio & constraints in the other dimension. + + We measure what the used value is by putting flex items in a small flex + container, which will shrink its items down to their min-height. + + This test checks for situations where we should resolve the min-height as + (a), (b), or (c) above. Another test will check (d). +--> + <style> + .flexbox { + display: flex; + flex-direction: column; + height: 1px; /* No available space; shrink flex items to min-height */ + margin-right: 2px; /* (Just for spacing things out, visually) */ + float: left; + } + + .flexbox > * { + /* Flex items have purple border: */ + border: 2px dotted purple; + } + + .flexbox > * > * { + /* Flex items' contents are gray & fixed-size: */ + background: gray; + width: 10px; + height: 80px; + } + </style> + </head> + <body> + <!-- Check for min-height:auto resolving correctly when the smallest + candidate value is: --> + <!-- *** (a) Used 'flex-basis' (from 'height') *** --> + <!-- First, without definite max-height: --> + <div class="flexbox"> + <div style="height: 50px"><div></div></div> + </div> + <!-- ...and now with definite (& large) 'max-height': --> + <div class="flexbox"> + <div style="height: 50px; max-height: 120px;"><div></div></div> + </div> + <!-- ...and now with used 'flex-basis' being a calc expression:--> + <div class="flexbox"> + <div style="height: calc(10% + 50px)"><div></div></div> + </div> + + <!-- *** (b) The computed 'max-height' *** --> + <!-- First, with a larger candidate 'flex-basis' value (from 'height') --> + <div class="flexbox"> + <div style="height: 100px; max-height:50px"><div></div></div> + </div> + <!-- ...and now with a larger explicit 'flex-basis' value (which shouldn't + be considered for 'min-height:auto' anyway) --> + <div class="flexbox"> + <div style="flex-basis: 100px; max-height:50px"><div></div></div> + </div> + <!-- ...and now with a smaller explicit 'flex-basis' value (which shouldn't + be considered for 'min-height:auto' anyway) --> + <div class="flexbox"> + <div style="flex-basis: 10px; max-height:50px"><div></div></div> + </div> + + <!-- *** (c) (no intrinsic aspect ratio) The min-content size *** --> + <!-- First, with a larger candidate 'flex-basis' value (from 'height') --> + <div class="flexbox"> + <div style="height: 100px"><div></div></div> + </div> + <!-- ...and now with a larger explicit 'flex-basis' value (which shouldn't + be considered for 'min-height:auto' anyway) --> + <div class="flexbox"> + <div style="flex-basis: 100px"><div></div></div> + </div> + <!-- ...and now with a smaller explicit 'flex-basis' value (which shouldn't + be considered for 'min-height:auto' anyway) --> + <div class="flexbox"> + <div style="flex-basis: 10px"><div></div></div> + </div> + </body> +</html>
new file mode 100644 --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-min-height-auto-002-ref.html @@ -0,0 +1,26 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Reftest Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + img { + width: 30px; + height: 30px; + float: left; + border: 2px dotted purple; + margin-right: 2px; /* (Just for spacing things out, visually) */ + } + </style> + </head> + <body> + <img src="support/solidblue.png" alt="blue square"> + <img src="support/solidblue.png" alt="blue square"> + <img src="support/solidblue.png" alt="blue square"> + </body> +</html>
new file mode 100644 --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-min-height-auto-002a.html @@ -0,0 +1,69 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: Testing min-height:auto</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="http://www.w3.org/TR/css3-flexbox/#min-size-auto"> + <link rel="match" href="flexbox-min-height-auto-002-ref.html"> +<!-- + This testcase tests the used value of "min-height:auto" (the property's + initial value) on flex items in a vertical flex container. + + It's supposed to resolve to the smallest of: + a) The used 'flex-basis' (taken from 'height'), if 'flex-basis' is at its + initial value. + b) The computed 'max-height' property + c) If there's no intrinsic aspect ratio: the item's min-content height. + d) If there is an intrinsic aspect ratio: the item's height derived from + the ratio & constraints in the other dimension. + + We measure what the used value is by putting flex items in a small flex + container, which will shrink its items down to their min-height. + + This test checks for situations where we should resolve the min-height as + (d) above, with "constraints in the other dimension" being "width". +--> + <style> + .flexbox { + display: flex; + flex-direction: column; + height: 1px; /* No available space; shrink flex items to min-height */ + margin-right: 2px; /* (Just for spacing things out, visually) */ + float: left; + } + + .flexbox > * { + /* Flex items have purple border: */ + border: 2px dotted purple; + /* Flex items have sizing constraint in cross axis: */ + width: 30px; + } + </style> + </head> + <body> + <!-- Check for min-height:auto resolving correctly when the smallest + candidate value is: --> + + <!-- *** (d) (with intrinsic aspect ratio) The height derived from ratio + and constraints in the other dimension *** --> + <!-- First, with a larger candidate 'flex-basis' value (from 'height') --> + <div class="flexbox"> + <img style="height: 100px" src="support/solidblue.png" alt="blue square"> + </div> + <!-- ...and now with a larger explicit 'flex-basis' value (which shouldn't + be considered for 'min-height:auto' anyway) --> + <div class="flexbox"> + <img style="flex-basis: 100px" src="support/solidblue.png" alt="blue square"> + </div> + <!-- ...and now with a smaller explicit 'flex-basis' value (which shouldn't + be considered for 'min-height:auto' anyway) --> + <div class="flexbox"> + <img style="flex-basis: 10px" src="support/solidblue.png" alt="blue square"> + </div> + </body> +</html>
new file mode 100644 --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-min-height-auto-002b.html @@ -0,0 +1,69 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: Testing min-height:auto</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="http://www.w3.org/TR/css3-flexbox/#min-size-auto"> + <link rel="match" href="flexbox-min-height-auto-002-ref.html"> +<!-- + This testcase tests the used value of "min-height:auto" (the property's + initial value) on flex items in a vertical flex container. + + It's supposed to resolve to the smallest of: + a) The used 'flex-basis' (taken from 'height'), if 'flex-basis' is at its + initial value. + b) The computed 'max-height' property + c) If there's no intrinsic aspect ratio: the item's min-content height. + d) If there is an intrinsic aspect ratio: the item's height derived from + the ratio & constraints in the other dimension. + + We measure what the used value is by putting flex items in a small flex + container, which will shrink its items down to their min-height. + + This test checks for situations where we should resolve the min-height as + (d) above, with "constraints in the other dimension" being "min-width". +--> + <style> + .flexbox { + display: flex; + flex-direction: column; + height: 1px; /* No available space; shrink flex items to min-height */ + margin-right: 2px; /* (Just for spacing things out, visually) */ + float: left; + } + + .flexbox > * { + /* Flex items have purple border: */ + border: 2px dotted purple; + /* Flex items have sizing constraint in cross axis: */ + min-width: 30px; + } + </style> + </head> + <body> + <!-- Check for min-height:auto resolving correctly when the smallest + candidate value is: --> + + <!-- *** (d) (with intrinsic aspect ratio) The height derived from ratio + and constraints in the other dimension *** --> + <!-- First, with a larger candidate 'flex-basis' value (from 'height') --> + <div class="flexbox"> + <img style="height: 100px" src="support/solidblue.png" alt="blue square"> + </div> + <!-- ...and now with a larger explicit 'flex-basis' value (which shouldn't + be considered for 'min-height:auto' anyway) --> + <div class="flexbox"> + <img style="flex-basis: 100px" src="support/solidblue.png" alt="blue square"> + </div> + <!-- ...and now with a smaller explicit 'flex-basis' value (which shouldn't + be considered for 'min-height:auto' anyway) --> + <div class="flexbox"> + <img style="flex-basis: 10px" src="support/solidblue.png" alt="blue square"> + </div> + </body> +</html>
new file mode 100644 --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-min-height-auto-002c.html @@ -0,0 +1,71 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: Testing min-height:auto</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="http://www.w3.org/TR/css3-flexbox/#min-size-auto"> + <link rel="match" href="flexbox-min-height-auto-002-ref.html"> +<!-- + This testcase tests the used value of "min-height:auto" (the property's + initial value) on flex items in a vertical flex container. + + It's supposed to resolve to the smallest of: + a) The used 'flex-basis' (taken from 'height'), if 'flex-basis' is at its + initial value. + b) The computed 'max-height' property + c) If there's no intrinsic aspect ratio: the item's min-content height. + d) If there is an intrinsic aspect ratio: the item's height derived from + the ratio & constraints in the other dimension. + + We measure what the used value is by putting flex items in a small flex + container, which will shrink its items down to their min-height. + + This test checks for situations where we should resolve the min-height as + (d) above, with "constraints in the other dimension" being + max-width-clamped "width". +--> + <style> + .flexbox { + display: flex; + flex-direction: column; + height: 1px; /* No available space; shrink flex items to min-height */ + margin-right: 2px; /* (Just for spacing things out, visually) */ + float: left; + } + + .flexbox > * { + /* Flex items have purple border: */ + border: 2px dotted purple; + /* Flex items have sizing constraint in cross axis: */ + max-width: 30px; + width: 60px; + } + </style> + </head> + <body> + <!-- Check for min-height:auto resolving correctly when the smallest + candidate value is: --> + + <!-- *** (d) (with intrinsic aspect ratio) The height derived from ratio + and constraints in the other dimension *** --> + <!-- First, with a larger candidate 'flex-basis' value (from 'height') --> + <div class="flexbox"> + <img style="height: 100px" src="support/solidblue.png" alt="blue square"> + </div> + <!-- ...and now with a larger explicit 'flex-basis' value (which shouldn't + be considered for 'min-height:auto' anyway) --> + <div class="flexbox"> + <img style="flex-basis: 100px" src="support/solidblue.png" alt="blue square"> + </div> + <!-- ...and now with a smaller explicit 'flex-basis' value (which shouldn't + be considered for 'min-height:auto' anyway) --> + <div class="flexbox"> + <img style="flex-basis: 10px" src="support/solidblue.png" alt="blue square"> + </div> + </body> +</html>
new file mode 100644 --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-min-height-auto-003-ref.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Reftest Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + .item { + /* Flex items have purple border: */ + border: 2px dotted purple; + margin-right: 2px; /* (Just for spacing things out, visually) */ + float: left; + } + + .small { height: 26px; } + .big { height: 80px; } + + .item > * { + /* Flex items' contents are gray & fixed-size: */ + background: gray; + width: 40px; + height: 80px; + } + + .yvisible { overflow-y: visible; } + .yhidden { overflow-y: hidden; } + .yscroll { overflow-y: scroll; } + .yauto { overflow-y: auto; } + </style> + </head> + <body> + <div class="item big yvisible"><div></div></div> + <div class="item small yhidden"><div></div></div> + <div class="item small yscroll"><div></div></div> + <div class="item small yauto"><div></div></div> + </body> +</html>
new file mode 100644 --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-min-height-auto-003.html @@ -0,0 +1,57 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: Testing min-height:auto & 'overflow' interaction</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="http://www.w3.org/TR/css3-flexbox/#min-size-auto"> + <link rel="match" href="flexbox-min-height-auto-003-ref.html"> +<!-- + This testcase checks how "overflow-y" impacts the sizing behavior of flex + items with "min-height:auto" (the new initial value for "min-height"). + + In particular, the flex-item-specific "min-height:auto" behavior is + supposed to be disabled (e.g. we end up with min-height:0) when + "overflow-y" is non-"visible". +--> + <style> + .flexbox { + display: flex; + flex-direction: column; + height: 30px; /* Shrink flex items below min-height */ + margin-right: 2px; /* (Just for spacing things out, visually) */ + float: left; + } + + .flexbox > * { + /* Flex items have purple border: */ + border: 2px dotted purple; + } + + .flexbox > * > * { + /* Flex items' contents are gray & fixed-size: */ + background: gray; + width: 40px; + height: 80px; + } + + .yvisible { overflow-y: visible; } + .yhidden { overflow-y: hidden; } + .yscroll { overflow-y: scroll; } + .yauto { overflow-y: auto; } + </style> + </head> + <body> + <!-- min-height:auto should prevent shrinking below intrinsic height when + the flex item has "overflow-y: visible", but not for any other + overflow-y values. --> + <div class="flexbox"><div class="yvisible"><div></div></div></div> + <div class="flexbox"><div class="yhidden"><div></div></div></div> + <div class="flexbox"><div class="yscroll"><div></div></div></div> + <div class="flexbox"><div class="yauto"><div></div></div></div> + </body> +</html>
new file mode 100644 --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-min-height-auto-004-ref.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Reftest Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + .item { + /* Flex items have purple border: */ + border: 2px dotted purple; + margin-right: 2px; /* (Just for spacing things out, visually) */ + float: left; + } + + .small { height: 26px; } + .big { height: 80px; } + + .item > * { + /* Flex items' contents are gray & fixed-size: */ + background: gray; + width: 40px; + height: 80px; + } + + .xvisible { overflow-x: visible; } + .xhidden { overflow-x: hidden; } + .xscroll { overflow-x: scroll; } + .xauto { overflow-x: auto; } + </style> + </head> + <body> + <div class="item big xvisible"><div></div></div> + <div class="item small xhidden"><div></div></div> + <div class="item small xscroll"><div></div></div> + <div class="item small xauto"><div></div></div> + </body> +</html>
new file mode 100644 --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-min-height-auto-004.html @@ -0,0 +1,63 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: Testing min-height:auto & 'overflow' interaction</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="http://www.w3.org/TR/css3-flexbox/#min-size-auto"> + <link rel="match" href="flexbox-min-height-auto-004-ref.html"> +<!-- + This testcase checks how "overflow-x" indirectly impacts the sizing + behavior of flex items with "min-height:auto" (the new initial value + for "min-height"), via its influence on "overflow-y". + + In particular, the flex-item-specific "min-height:auto" behavior is + supposed to be disabled (e.g. we end up with min-height:0) when + "overflow-y" is non-"visible". Moreover, when "overflow-x" is set to a + scrolling value, it forces "overflow-y" to compute to a scrolling value + as well, as described at + http://www.w3.org/TR/css-overflow-3/#overflow-properties + So, "overflow-x" has an indirect effect (via "overflow-y") here. +--> + <style> + .flexbox { + display: flex; + flex-direction: column; + height: 30px; /* Shrink flex items below min-height */ + margin-right: 2px; /* (Just for spacing things out, visually) */ + float: left; + } + + .flexbox > * { + /* Flex items have purple border: */ + border: 2px dotted purple; + } + + .flexbox > * > * { + /* Flex items' contents are gray & fixed-size: */ + background: gray; + width: 40px; + height: 80px; + } + + .xvisible { overflow-x: visible; } + .xhidden { overflow-x: hidden; } + .xscroll { overflow-x: scroll; } + .xauto { overflow-x: auto; } + </style> + </head> + <body> + <!-- min-height:auto should prevent shrinking below intrinsic height when + the flex item has "overflow-x: visible", but not for any other + overflow-x values (because of overflow-x's influence on overflow-y). + --> + <div class="flexbox"><div class="xvisible"><div></div></div></div> + <div class="flexbox"><div class="xhidden"><div></div></div></div> + <div class="flexbox"><div class="xscroll"><div></div></div></div> + <div class="flexbox"><div class="xauto"><div></div></div></div> + </body> +</html>
new file mode 100644 --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-min-width-auto-001-ref.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Reftest Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + .item { + /* Flex items have purple border: */ + border: 2px dotted purple; + margin-bottom: 2px; /* (Just for spacing things out, visually) */ + } + + .small { width: 50px; } + .big { width: 80px; } + + .item > * { + /* Flex items' contents are gray & fixed-size: */ + background: gray; + height: 10px; + width: 80px; + } + </style> + </head> + <body> + <div class="item small"><div></div></div> + <div class="item small"><div></div></div> + <div class="item small"><div></div></div> + <div class="item small"><div></div></div> + <div class="item small"><div></div></div> + <div class="item small"><div></div></div> + + <div class="item big"><div></div></div> + <div class="item big"><div></div></div> + <div class="item big"><div></div></div> + </body> +</html>
new file mode 100644 --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-min-width-auto-001.html @@ -0,0 +1,100 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: Testing min-width:auto</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="http://www.w3.org/TR/css3-flexbox/#min-size-auto"> + <link rel="match" href="flexbox-min-width-auto-001-ref.html"> +<!-- + This testcase tests the used value of "min-width:auto" (the property's + initial value) on flex items in a horizontal flex container. + + It's supposed to resolve to the smallest of: + a) The used 'flex-basis' (taken from 'width'), if 'flex-basis' is at its + initial value. + b) The computed 'max-width' property + c) If there's no intrinsic aspect ratio: the item's min-content width. + d) If there is an intrinsic aspect ratio: the item's width derived from + the ratio & constraints in the other dimension. + + We measure what the used value is by putting flex items in a small flex + container, which will shrink its items down to their min-width. + + This test checks for situations where we should resolve the min-width as + (a), (b), or (c) above. Another test will check (d). +--> + <style> + .flexbox { + display: flex; + width: 1px; /* No available space; shrink flex items to min-width */ + margin-bottom: 2px; /* (Just for spacing things out, visually) */ + } + + .flexbox > * { + /* Flex items have purple border: */ + border: 2px dotted purple; + } + + .flexbox > * > * { + /* Flex items' contents are gray & fixed-size: */ + background: gray; + height: 10px; + width: 80px; + } + </style> + </head> + <body> + <!-- Check for min-width:auto resolving correctly when the smallest + candidate value is: --> + <!-- *** (a) Used 'flex-basis' (from 'width') *** --> + <!-- First, without definite max-width: --> + <div class="flexbox"> + <div style="width: 50px"><div></div></div> + </div> + <!-- ...and now with definite (& large) 'max-width': --> + <div class="flexbox"> + <div style="width: 50px; max-width: 120px;"><div></div></div> + </div> + <!-- ...and now with used 'flex-basis' being a calc expression:--> + <div class="flexbox"> + <div style="width: calc(10% + 50px)"><div></div></div> + </div> + + <!-- *** (b) The computed 'max-width' *** --> + <!-- First, with a larger candidate 'flex-basis' value (from 'width') --> + <div class="flexbox"> + <div style="width: 100px; max-width:50px"><div></div></div> + </div> + <!-- ...and now with a larger explicit 'flex-basis' value (which shouldn't + be considered for 'min-width:auto' anyway) --> + <div class="flexbox"> + <div style="flex-basis: 100px; max-width:50px"><div></div></div> + </div> + <!-- ...and now with a smaller explicit 'flex-basis' value (which shouldn't + be considered for 'min-width:auto' anyway) --> + <div class="flexbox"> + <div style="flex-basis: 10px; max-width:50px"><div></div></div> + </div> + + <!-- *** (c) (no intrinsic aspect ratio) The min-content size *** --> + <!-- First, with a larger candidate 'flex-basis' value (from 'width') --> + <div class="flexbox"> + <div style="width: 100px"><div></div></div> + </div> + <!-- ...and now with a larger explicit 'flex-basis' value (which shouldn't + be considered for 'min-width:auto' anyway) --> + <div class="flexbox"> + <div style="flex-basis: 100px"><div></div></div> + </div> + <!-- ...and now with a smaller explicit 'flex-basis' value (which shouldn't + be considered for 'min-width:auto' anyway) --> + <div class="flexbox"> + <div style="flex-basis: 10px"><div></div></div> + </div> + </body> +</html>
new file mode 100644 --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-min-width-auto-002-ref.html @@ -0,0 +1,26 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Reftest Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + img { + width: 30px; + height: 30px; + display: block; + border: 2px dotted purple; + margin-bottom: 2px; /* (Just for spacing things out, visually) */ + } + </style> + </head> + <body> + <img src="support/solidblue.png" alt="blue square"> + <img src="support/solidblue.png" alt="blue square"> + <img src="support/solidblue.png" alt="blue square"> + </body> +</html>
new file mode 100644 --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-min-width-auto-002a.html @@ -0,0 +1,67 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: Testing min-width:auto</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="http://www.w3.org/TR/css3-flexbox/#min-size-auto"> + <link rel="match" href="flexbox-min-width-auto-002-ref.html"> +<!-- + This testcase tests the used value of "min-width:auto" (the property's + initial value) on flex items in a horizontal flex container. + + It's supposed to resolve to the smallest of: + a) The used 'flex-basis' (taken from 'width'), if 'flex-basis' is at its + initial value. + b) The computed 'max-width' property + c) If there's no intrinsic aspect ratio: the item's min-content width. + d) If there is an intrinsic aspect ratio: the item's width derived from + the ratio & constraints in the other dimension. + + We measure what the used value is by putting flex items in a small flex + container, which will shrink its items down to their min-width. + + This test checks for situations where we should resolve the min-width as + (d) above, with "constraints in the other dimension" being "height". +--> + <style> + .flexbox { + display: flex; + width: 0px; /* No available space; shrink flex items to min-width */ + margin-bottom: 2px; /* (Just for spacing things out, visually) */ + } + + .flexbox > * { + /* Flex items have purple border: */ + border: 2px dotted purple; + /* Flex items have sizing constraint in cross axis: */ + height: 30px; + } + </style> + </head> + <body> + <!-- Check for min-width:auto resolving correctly when the smallest + candidate value is: --> + + <!-- *** (d) (with intrinsic aspect ratio) The width derived from ratio + and constraints in the other dimension *** --> + <!-- First, with a larger candidate 'flex-basis' value (from 'width') --> + <div class="flexbox"> + <img style="width: 100px" src="support/solidblue.png" alt="blue square"> + </div> + <!-- ...and now with a larger explicit 'flex-basis' value (which shouldn't + be considered for 'min-width:auto' anyway) --> + <div class="flexbox"> + <img style="flex-basis: 100px" src="support/solidblue.png" alt="blue square"> + </div> + <!-- ...and now with a smaller explicit 'flex-basis' value (which shouldn't + be considered for 'min-width:auto' anyway) --> + <div class="flexbox"> + <img style="flex-basis: 10px" src="support/solidblue.png" alt="blue square"> + </div> + </body> +</html>
new file mode 100644 --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-min-width-auto-002b.html @@ -0,0 +1,67 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: Testing min-width:auto</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="http://www.w3.org/TR/css3-flexbox/#min-size-auto"> + <link rel="match" href="flexbox-min-width-auto-002-ref.html"> +<!-- + This testcase tests the used value of "min-width:auto" (the property's + initial value) on flex items in a horizontal flex container. + + It's supposed to resolve to the smallest of: + a) The used 'flex-basis' (taken from 'width'), if 'flex-basis' is at its + initial value. + b) The computed 'max-width' property + c) If there's no intrinsic aspect ratio: the item's min-content width. + d) If there is an intrinsic aspect ratio: the item's width derived from + the ratio & constraints in the other dimension. + + We measure what the used value is by putting flex items in a small flex + container, which will shrink its items down to their min-width. + + This test checks for situations where we should resolve the min-width as + (d) above, with "constraints in the other dimension" being "min-height". +--> + <style> + .flexbox { + display: flex; + width: 0px; /* No available space; shrink flex items to min-width */ + margin-bottom: 2px; /* (Just for spacing things out, visually) */ + } + + .flexbox > * { + /* Flex items have purple border: */ + border: 2px dotted purple; + /* Flex items have sizing constraint in cross axis: */ + min-height: 30px; + } + </style> + </head> + <body> + <!-- Check for min-width:auto resolving correctly when the smallest + candidate value is: --> + + <!-- *** (d) (with intrinsic aspect ratio) The width derived from ratio + and constraints in the other dimension *** --> + <!-- First, with a larger candidate 'flex-basis' value (from 'width') --> + <div class="flexbox"> + <img style="width: 100px" src="support/solidblue.png" alt="blue square"> + </div> + <!-- ...and now with a larger explicit 'flex-basis' value (which shouldn't + be considered for 'min-width:auto' anyway) --> + <div class="flexbox"> + <img style="flex-basis: 100px" src="support/solidblue.png" alt="blue square"> + </div> + <!-- ...and now with a smaller explicit 'flex-basis' value (which shouldn't + be considered for 'min-width:auto' anyway) --> + <div class="flexbox"> + <img style="flex-basis: 10px" src="support/solidblue.png" alt="blue square"> + </div> + </body> +</html>
new file mode 100644 --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-min-width-auto-002c.html @@ -0,0 +1,69 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: Testing min-width:auto</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="http://www.w3.org/TR/css3-flexbox/#min-size-auto"> + <link rel="match" href="flexbox-min-width-auto-002-ref.html"> +<!-- + This testcase tests the used value of "min-width:auto" (the property's + initial value) on flex items in a horizontal flex container. + + It's supposed to resolve to the smallest of: + a) The used 'flex-basis' (taken from 'width'), if 'flex-basis' is at its + initial value. + b) The computed 'max-width' property + c) If there's no intrinsic aspect ratio: the item's min-content width. + d) If there is an intrinsic aspect ratio: the item's width derived from + the ratio & constraints in the other dimension. + + We measure what the used value is by putting flex items in a small flex + container, which will shrink its items down to their min-width. + + This test checks for situations where we should resolve the min-width as + (d) above, with "constraints in the other dimension" being + max-height-clamped "height". +--> + <style> + .flexbox { + display: flex; + width: 0px; /* No available space; shrink flex items to min-width */ + margin-bottom: 2px; /* (Just for spacing things out, visually) */ + } + + .flexbox > * { + /* Flex items have purple border: */ + border: 2px dotted purple; + /* Flex items have sizing constraint in cross axis: */ + max-height: 30px; + height: 60px; + } + </style> + </head> + <body> + <!-- Check for min-width:auto resolving correctly when the smallest + candidate value is: --> + + <!-- *** (d) (with intrinsic aspect ratio) The width derived from ratio + and constraints in the other dimension *** --> + <!-- First, with a larger candidate 'flex-basis' value (from 'width') --> + <div class="flexbox"> + <img style="width: 100px" src="support/solidblue.png" alt="blue square"> + </div> + <!-- ...and now with a larger explicit 'flex-basis' value (which shouldn't + be considered for 'min-width:auto' anyway) --> + <div class="flexbox"> + <img style="flex-basis: 100px" src="support/solidblue.png" alt="blue square"> + </div> + <!-- ...and now with a smaller explicit 'flex-basis' value (which shouldn't + be considered for 'min-width:auto' anyway) --> + <div class="flexbox"> + <img style="flex-basis: 10px" src="support/solidblue.png" alt="blue square"> + </div> + </body> +</html>
new file mode 100644 --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-min-width-auto-003-ref.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Reftest Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + .item { + /* Flex items have purple border: */ + border: 2px dotted purple; + margin-bottom: 2px; /* (Just for spacing things out, visually) */ + } + + .small { width: 26px; } + .big { width: 80px; } + + .item > * { + /* Flex items' contents are gray & fixed-size: */ + background: gray; + height: 40px; + width: 80px; + } + + .xvisible { overflow-x: visible; } + .xhidden { overflow-x: hidden; } + .xscroll { overflow-x: scroll; } + .xauto { overflow-x: auto; } + </style> + </head> + <body> + <div class="item big xvisible"><div></div></div> + <div class="item small xhidden"><div></div></div> + <div class="item small xscroll"><div></div></div> + <div class="item small xauto"><div></div></div> + </body> +</html>
new file mode 100644 --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-min-width-auto-003.html @@ -0,0 +1,55 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: Testing min-width:auto & 'overflow' interaction</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="http://www.w3.org/TR/css3-flexbox/#min-size-auto"> + <link rel="match" href="flexbox-min-width-auto-003-ref.html"> +<!-- + This testcase checks how "overflow-x" impacts the sizing behavior of flex + items with "min-width:auto" (the new initial value for "min-width"). + + In particular, the flex-item-specific "min-width:auto" behavior is + supposed to be disabled (e.g. we end up with min-width:0) when + "overflow-x" is non-"visible". +--> + <style> + .flexbox { + display: flex; + width: 30px; /* Shrink flex items below min-width */ + margin-bottom: 2px; /* (Just for spacing things out, visually) */ + } + + .flexbox > * { + /* Flex items have purple border: */ + border: 2px dotted purple; + } + + .flexbox > * > * { + /* Flex items' contents are gray & fixed-size: */ + background: gray; + height: 40px; + width: 80px; + } + + .xvisible { overflow-x: visible; } + .xhidden { overflow-x: hidden; } + .xscroll { overflow-x: scroll; } + .xauto { overflow-x: auto; } + </style> + </head> + <body> + <!-- min-width:auto should prevent shrinking below intrinsic width when + the flex item has "overflow-x: visible", but not for any other + overflow-x values. --> + <div class="flexbox"><div class="xvisible"><div></div></div></div> + <div class="flexbox"><div class="xhidden"><div></div></div></div> + <div class="flexbox"><div class="xscroll"><div></div></div></div> + <div class="flexbox"><div class="xauto"><div></div></div></div> + </body> +</html>
new file mode 100644 --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-min-width-auto-004-ref.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Reftest Reference</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <style> + .item { + /* Flex items have purple border: */ + border: 2px dotted purple; + margin-bottom: 2px; /* (Just for spacing things out, visually) */ + } + + .small { width: 26px; } + .big { width: 80px; } + + .item > * { + /* Flex items' contents are gray & fixed-size: */ + background: gray; + height: 40px; + width: 80px; + } + + .yvisible { overflow-y: visible; } + .yhidden { overflow-y: hidden; } + .yscroll { overflow-y: scroll; } + .yauto { overflow-y: auto; } + </style> + </head> + <body> + <div class="item big yvisible"><div></div></div> + <div class="item small yhidden"><div></div></div> + <div class="item small yscroll"><div></div></div> + <div class="item small yauto"><div></div></div> + </body> +</html>
new file mode 100644 --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-min-width-auto-004.html @@ -0,0 +1,61 @@ +<!DOCTYPE html> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: Testing min-width:auto & 'overflow' interaction</title> + <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> + <link rel="help" href="http://www.w3.org/TR/css3-flexbox/#min-size-auto"> + <link rel="match" href="flexbox-min-width-auto-004-ref.html"> +<!-- + This testcase checks how "overflow-y" indirectly impacts the sizing + behavior of flex items with "min-width:auto" (the new initial value + for "min-width"), via its influence on "overflow-x". + + In particular, the flex-item-specific "min-width:auto" behavior is + supposed to be disabled (e.g. we end up with min-width:0) when + "overflow-x" is non-"visible". Moreover, when "overflow-y" is set to a + scrolling value, it forces "overflow-x" to compute to a scrolling value + as well, as described at + http://www.w3.org/TR/css-overflow-3/#overflow-properties + So, "overflow-y" has an indirect effect (via "overflow-x") here. +--> + <style> + .flexbox { + display: flex; + width: 30px; /* Shrink flex items below min-width */ + margin-bottom: 2px; /* (Just for spacing things out, visually) */ + } + + .flexbox > * { + /* Flex items have purple border: */ + border: 2px dotted purple; + } + + .flexbox > * > * { + /* Flex items' contents are gray & fixed-size: */ + background: gray; + height: 40px; + width: 80px; + } + + .yvisible { overflow-y: visible; } + .yhidden { overflow-y: hidden; } + .yscroll { overflow-y: scroll; } + .yauto { overflow-y: auto; } + </style> + </head> + <body> + <!-- min-width:auto should prevent shrinking below intrinsic width when + the flex item has "overflow-y: visible", but not for any other + overflow-y values (because of overflow-y's influence on overflow-x). + --> + <div class="flexbox"><div class="yvisible"><div></div></div></div> + <div class="flexbox"><div class="yhidden"><div></div></div></div> + <div class="flexbox"><div class="yscroll"><div></div></div></div> + <div class="flexbox"><div class="yauto"><div></div></div></div> + </body> +</html>
--- a/layout/reftests/w3c-css/submitted/flexbox/reftest.list +++ b/layout/reftests/w3c-css/submitted/flexbox/reftest.list @@ -124,16 +124,30 @@ fuzzy-if(Android,158,32) == flexbox-alig == flexbox-mbp-horiz-1-rtl.xhtml flexbox-mbp-horiz-1-reverse-ref.xhtml == flexbox-mbp-horiz-1-rtl-reverse.xhtml flexbox-mbp-horiz-1-ref.xhtml == flexbox-mbp-horiz-2a.xhtml flexbox-mbp-horiz-2-ref.xhtml == flexbox-mbp-horiz-2b.xhtml flexbox-mbp-horiz-2-ref.xhtml == flexbox-mbp-horiz-3.xhtml flexbox-mbp-horiz-3-ref.xhtml == flexbox-mbp-horiz-3-reverse.xhtml flexbox-mbp-horiz-3-reverse-ref.xhtml == flexbox-mbp-horiz-4.xhtml flexbox-mbp-horiz-4-ref.xhtml +# Tests for min-height:auto / min-width:auto on flex items +== flexbox-min-height-auto-001.html flexbox-min-height-auto-001-ref.html +== flexbox-min-height-auto-002a.html flexbox-min-height-auto-002-ref.html +fails == flexbox-min-height-auto-002b.html flexbox-min-height-auto-002-ref.html # Bug 1041019 +== flexbox-min-height-auto-002c.html flexbox-min-height-auto-002-ref.html +== flexbox-min-height-auto-003.html flexbox-min-height-auto-003-ref.html +== flexbox-min-height-auto-004.html flexbox-min-height-auto-004-ref.html +== flexbox-min-width-auto-001.html flexbox-min-width-auto-001-ref.html +== flexbox-min-width-auto-002a.html flexbox-min-width-auto-002-ref.html +fails == flexbox-min-width-auto-002b.html flexbox-min-width-auto-002-ref.html # Bug 1041019 +== flexbox-min-width-auto-002c.html flexbox-min-width-auto-002-ref.html +== flexbox-min-width-auto-003.html flexbox-min-width-auto-003-ref.html +== flexbox-min-width-auto-004.html flexbox-min-width-auto-004-ref.html + # Tests for flex containers with the "overflow" property set == flexbox-overflow-horiz-1.html flexbox-overflow-horiz-1-ref.html == flexbox-overflow-horiz-2.html flexbox-overflow-horiz-2-ref.html == flexbox-overflow-horiz-3.html flexbox-overflow-horiz-3-ref.html == flexbox-overflow-horiz-4.html flexbox-overflow-horiz-4-ref.html == flexbox-overflow-horiz-5.html flexbox-overflow-horiz-5-ref.html == flexbox-overflow-vert-1.html flexbox-overflow-vert-1-ref.html == flexbox-overflow-vert-2.html flexbox-overflow-vert-2-ref.html
--- a/layout/style/nsCSSPropList.h +++ b/layout/style/nsCSSPropList.h @@ -2494,30 +2494,30 @@ CSS_PROP_POSITION( min-height, min_height, MinHeight, CSS_PROPERTY_PARSE_VALUE | CSS_PROPERTY_VALUE_NONNEGATIVE | CSS_PROPERTY_STORES_CALC | CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH, "", - VARIANT_HLP | VARIANT_CALC, + VARIANT_AHLP | VARIANT_CALC, nullptr, offsetof(nsStylePosition, mMinHeight), eStyleAnimType_Coord) CSS_PROP_POSITION( min-width, min_width, MinWidth, CSS_PROPERTY_PARSE_VALUE | CSS_PROPERTY_VALUE_NONNEGATIVE | CSS_PROPERTY_STORES_CALC | CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH, "", - VARIANT_HKLP | VARIANT_CALC, + VARIANT_AHKLP | VARIANT_CALC, kWidthKTable, offsetof(nsStylePosition, mMinWidth), eStyleAnimType_Coord) CSS_PROP_DISPLAY( mix-blend-mode, mix_blend_mode, MixBlendMode, CSS_PROPERTY_PARSE_VALUE |
--- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -9,24 +9,27 @@ #include "nsComputedDOMStyle.h" #include "mozilla/ArrayUtils.h" #include "mozilla/Preferences.h" #include "nsError.h" #include "nsDOMString.h" #include "nsIDOMCSSPrimitiveValue.h" +#include "nsIFrame.h" +#include "nsIFrameInlines.h" #include "nsStyleContext.h" #include "nsIScrollableFrame.h" #include "nsContentUtils.h" #include "nsIContent.h" #include "nsDOMCSSRect.h" #include "nsDOMCSSRGBColor.h" #include "nsDOMCSSValueList.h" +#include "nsFlexContainerFrame.h" #include "nsGkAtoms.h" #include "nsHTMLReflowState.h" #include "nsStyleUtil.h" #include "nsStyleStructInlines.h" #include "nsROCSSPrimitiveValue.h" #include "nsPresContext.h" #include "nsIDocument.h" @@ -4098,26 +4101,54 @@ nsComputedDOMStyle::DoGetMaxWidth() nsCSSProps::kWidthKTable); return val; } CSSValue* nsComputedDOMStyle::DoGetMinHeight() { nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue; - SetValueToCoord(val, StylePosition()->mMinHeight, true, + nsStyleCoord minHeight = StylePosition()->mMinHeight; + + if (eStyleUnit_Auto == minHeight.GetUnit()) { + // In non-flexbox contexts, "min-height: auto" means "min-height: 0" + // XXXdholbert For flex items, we should set |minHeight| to the + // -moz-min-content keyword, instead of 0, once we support -moz-min-content + // as a height value. + minHeight.SetCoordValue(0); + } + + SetValueToCoord(val, minHeight, true, &nsComputedDOMStyle::GetCBContentHeight); return val; } CSSValue* nsComputedDOMStyle::DoGetMinWidth() { nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue; - SetValueToCoord(val, StylePosition()->mMinWidth, true, + + nsStyleCoord minWidth = StylePosition()->mMinWidth; + + if (eStyleUnit_Auto == minWidth.GetUnit()) { + // "min-width: auto" means "0", unless we're a flex item in a horizontal + // flex container, in which case it means "min-content" + minWidth.SetCoordValue(0); + if (mOuterFrame && mOuterFrame->IsFlexItem()) { + nsIFrame* flexContainer = mOuterFrame->GetParent(); + MOZ_ASSERT(flexContainer && + flexContainer->GetType() == nsGkAtoms::flexContainerFrame, + "IsFlexItem() lied...?"); + + if (static_cast<nsFlexContainerFrame*>(flexContainer)->IsHorizontal()) { + minWidth.SetIntValue(NS_STYLE_WIDTH_MIN_CONTENT, eStyleUnit_Enumerated); + } + } + } + SetValueToCoord(val, minWidth, true, &nsComputedDOMStyle::GetCBContentWidth, nsCSSProps::kWidthKTable); return val; } CSSValue* nsComputedDOMStyle::DoGetMixBlendMode() {
--- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -7427,30 +7427,30 @@ nsRuleNode::ComputePositionData(void* aS } } SetCoord(*aRuleData->ValueForWidth(), pos->mWidth, parentPos->mWidth, SETCOORD_LPAEH | SETCOORD_INITIAL_AUTO | SETCOORD_STORE_CALC | SETCOORD_UNSET_INITIAL, aContext, mPresContext, canStoreInRuleTree); SetCoord(*aRuleData->ValueForMinWidth(), pos->mMinWidth, parentPos->mMinWidth, - SETCOORD_LPEH | SETCOORD_INITIAL_ZERO | SETCOORD_STORE_CALC | + SETCOORD_LPAEH | SETCOORD_INITIAL_AUTO | SETCOORD_STORE_CALC | SETCOORD_UNSET_INITIAL, aContext, mPresContext, canStoreInRuleTree); SetCoord(*aRuleData->ValueForMaxWidth(), pos->mMaxWidth, parentPos->mMaxWidth, SETCOORD_LPOEH | SETCOORD_INITIAL_NONE | SETCOORD_STORE_CALC | SETCOORD_UNSET_INITIAL, aContext, mPresContext, canStoreInRuleTree); SetCoord(*aRuleData->ValueForHeight(), pos->mHeight, parentPos->mHeight, SETCOORD_LPAH | SETCOORD_INITIAL_AUTO | SETCOORD_STORE_CALC | SETCOORD_UNSET_INITIAL, aContext, mPresContext, canStoreInRuleTree); SetCoord(*aRuleData->ValueForMinHeight(), pos->mMinHeight, parentPos->mMinHeight, - SETCOORD_LPH | SETCOORD_INITIAL_ZERO | SETCOORD_STORE_CALC | + SETCOORD_LPAH | SETCOORD_INITIAL_AUTO | SETCOORD_STORE_CALC | SETCOORD_UNSET_INITIAL, aContext, mPresContext, canStoreInRuleTree); SetCoord(*aRuleData->ValueForMaxHeight(), pos->mMaxHeight, parentPos->mMaxHeight, SETCOORD_LPOH | SETCOORD_INITIAL_NONE | SETCOORD_STORE_CALC | SETCOORD_UNSET_INITIAL, aContext, mPresContext, canStoreInRuleTree); // box-sizing: enum, inherit, initial
--- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -1226,20 +1226,20 @@ nsStylePosition::nsStylePosition(void) MOZ_COUNT_CTOR(nsStylePosition); // positioning values not inherited nsStyleCoord autoCoord(eStyleUnit_Auto); mOffset.SetLeft(autoCoord); mOffset.SetTop(autoCoord); mOffset.SetRight(autoCoord); mOffset.SetBottom(autoCoord); mWidth.SetAutoValue(); - mMinWidth.SetCoordValue(0); + mMinWidth.SetAutoValue(); mMaxWidth.SetNoneValue(); mHeight.SetAutoValue(); - mMinHeight.SetCoordValue(0); + mMinHeight.SetAutoValue(); mMaxHeight.SetNoneValue(); mFlexBasis.SetAutoValue(); // The initial value of grid-auto-columns and grid-auto-rows is 'auto', // which computes to 'minmax(min-content, max-content)'. mGridAutoColumnsMin.SetIntValue(NS_STYLE_GRID_TRACK_BREADTH_MIN_CONTENT, eStyleUnit_Enumerated); mGridAutoColumnsMax.SetIntValue(NS_STYLE_GRID_TRACK_BREADTH_MAX_CONTENT, @@ -1439,18 +1439,17 @@ nsChangeHint nsStylePosition::CalcDiffer } } return hint; } /* static */ bool nsStylePosition::WidthCoordDependsOnContainer(const nsStyleCoord &aCoord) { - return aCoord.GetUnit() == eStyleUnit_Auto || - aCoord.HasPercent() || + return aCoord.HasPercent() || (aCoord.GetUnit() == eStyleUnit_Enumerated && (aCoord.GetIntValue() == NS_STYLE_WIDTH_FIT_CONTENT || aCoord.GetIntValue() == NS_STYLE_WIDTH_AVAILABLE)); } // -------------------- // nsStyleTable //
--- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -1351,47 +1351,62 @@ struct nsStylePosition { nsRefPtr<mozilla::css::GridTemplateAreasValue> mGridTemplateAreas; nsStyleGridLine mGridColumnStart; nsStyleGridLine mGridColumnEnd; nsStyleGridLine mGridRowStart; nsStyleGridLine mGridRowEnd; bool WidthDependsOnContainer() const - { return WidthCoordDependsOnContainer(mWidth); } + { + return mWidth.GetUnit() == eStyleUnit_Auto || + WidthCoordDependsOnContainer(mWidth); + } + + // NOTE: For a flex item, "min-width:auto" is supposed to behave like + // "min-content", which does depend on the container, so you might think we'd + // need a special case for "flex item && min-width:auto" here. However, + // we don't actually need that special-case code, because flex items are + // explicitly supposed to *ignore* their min-width (i.e. behave like it's 0) + // until the flex container explicitly considers it. So -- since the flex + // container doesn't rely on this method, we don't need to worry about + // special behavior for flex items' "min-width:auto" values here. bool MinWidthDependsOnContainer() const { return WidthCoordDependsOnContainer(mMinWidth); } bool MaxWidthDependsOnContainer() const { return WidthCoordDependsOnContainer(mMaxWidth); } // Note that these functions count 'auto' as depending on the // container since that's the case for absolutely positioned elements. // However, some callers do not care about this case and should check // for it, since it is the most common case. // FIXME: We should probably change the assumption to be the other way // around. bool HeightDependsOnContainer() const - { return HeightCoordDependsOnContainer(mHeight); } + { + return mHeight.GetUnit() == eStyleUnit_Auto || // CSS 2.1, 10.6.4, item (5) + HeightCoordDependsOnContainer(mHeight); + } + + // NOTE: The comment above MinWidthDependsOnContainer about flex items + // applies here, too. bool MinHeightDependsOnContainer() const { return HeightCoordDependsOnContainer(mMinHeight); } bool MaxHeightDependsOnContainer() const { return HeightCoordDependsOnContainer(mMaxHeight); } bool OffsetHasPercent(mozilla::css::Side aSide) const { return mOffset.Get(aSide).HasPercent(); } private: static bool WidthCoordDependsOnContainer(const nsStyleCoord &aCoord); static bool HeightCoordDependsOnContainer(const nsStyleCoord &aCoord) - { - return aCoord.GetUnit() == eStyleUnit_Auto || // CSS 2.1, 10.6.4, item (5) - aCoord.HasPercent(); - } + { return aCoord.HasPercent(); } }; struct nsStyleTextOverflowSide { nsStyleTextOverflowSide() : mType(NS_STYLE_TEXT_OVERFLOW_CLIP) {} bool operator==(const nsStyleTextOverflowSide& aOther) const { return mType == aOther.mType && (mType != NS_STYLE_TEXT_OVERFLOW_STRING ||
--- a/layout/style/test/mochitest.ini +++ b/layout/style/test/mochitest.ini @@ -123,16 +123,17 @@ skip-if = toolkit == 'android' #bug 5366 [test_dont_use_document_colors.html] [test_extra_inherit_initial.html] [test_flexbox_align_self_auto.html] [test_flexbox_child_display_values.xhtml] [test_flexbox_flex_grow_and_shrink.html] [test_flexbox_flex_shorthand.html] [test_flexbox_layout.html] support-files = flexbox_layout_testcases.js +[test_flexbox_min_size_auto.html] [test_flexbox_order.html] [test_flexbox_order_table.html] [test_font_face_parser.html] [test_font_family_parsing.html] [test_font_feature_values_parsing.html] [test_garbage_at_end_of_declarations.html] [test_grid_item_shorthands.html] [test_grid_container_shorthands.html]
--- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -2822,40 +2822,40 @@ var gCSSProperties = { ], invalid_values: [ "auto", "5" ] }, "min-height": { domProp: "minHeight", inherited: false, type: CSS_TYPE_LONGHAND, prerequisites: { "display": "block" }, - initial_values: [ "0", "calc(0em)", "calc(-2px)", "calc(-1%)" ], + initial_values: [ "auto", "0", "calc(0em)", "calc(-2px)", "calc(-1%)" ], other_values: [ "30px", "50%", "calc(2px)", "calc(50%)", "calc(3*25px)", "calc(25px*3)", "calc(3*25px + 50%)", ], - invalid_values: [ "auto", "none", "-moz-max-content", "-moz-min-content", "-moz-fit-content", "-moz-available", "5" ] + invalid_values: ["none", "-moz-max-content", "-moz-min-content", "-moz-fit-content", "-moz-available", "5" ] }, "min-width": { domProp: "minWidth", inherited: false, type: CSS_TYPE_LONGHAND, prerequisites: { "display": "block" }, - initial_values: [ "0", "calc(0em)", "calc(-2px)", "calc(-1%)" ], + initial_values: [ "auto", "0", "calc(0em)", "calc(-2px)", "calc(-1%)" ], other_values: [ "30px", "50%", "-moz-max-content", "-moz-min-content", "-moz-fit-content", "-moz-available", "calc(2px)", "calc(50%)", "calc(3*25px)", "calc(25px*3)", "calc(3*25px + 50%)", ], - invalid_values: [ "auto", "none", "5" ] + invalid_values: [ "none", "5" ] }, "opacity": { domProp: "opacity", inherited: false, type: CSS_TYPE_LONGHAND, initial_values: [ "1", "17", "397.376", "3e1", "3e+1", "3e0", "3e+0", "3e-0" ], other_values: [ "0", "0.4", "0.0000", "-3", "3e-1" ],
new file mode 100644 --- /dev/null +++ b/layout/style/test/test_flexbox_min_size_auto.html @@ -0,0 +1,144 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=763689 +--> +<head> + <meta charset="utf-8"> + <title>Test behavior of 'min-height:auto' and 'min-width:auto' (Bug 763689)</title> + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> +</head> +<body> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=763689">Mozilla Bug 763689</a> +<body> +<div id="display"> + <div id="non-flex-item">abc</div> + <div style="display: flex"> + <div id="horizontal-flex-item">abc</div> + </div> + <div style="display: flex; flex-direction: column"> + <div id="vertical-flex-item">abc</div> + </div> +</div> +<pre id="test"> +<script type="application/javascript"> +"use strict"; + +/** + * Test 'min-height:auto' and 'min-width:auto' (Bug 763689) + * ======================================================== + * This test checks the computed-style value of the "auto" keyword introduced + * for the "min-height" and "min-width" properties in CSS3 Flexbox Section 4.5. + * http://www.w3.org/TR/css3-flexbox/#min-size-auto + * + * Quoting that chunk of spec: + * # auto + * # When used as the value of a flex item's min main size property, + * # this keyword indicates a minimum of the min-content size, to + * # help ensure that the item is large enough to fit its contents. + * # + * # | It is intended that this will compute to the 'min-content' + * # | keyword when the specification defining it (Writing Modes + * # | Appendix D) is sufficiently mature. + * # + * # Otherwise, this keyword computes to '0' (unless otherwise + * # defined by a future specification). + * + * So, since we already support the "min-content" keyword, this effectively + * means: + * - On a horizontal flex item, "min-width: auto" computes to "min-content". + * - On a vertical flex item, "min-height: auto" computes to "min-content". + * - In all other cases, "min-[width|height]: auto" computes to 0. + * That's what this mochitest aims to check, via getComputedStyle(). + * + * NOTE: As of this test's writing, we don't yet support enumerated keyword + * values (including "min-content") for the "min-height" property. So for + * now, "min-height: auto" always produces "0" in getComputedStyle, even on + * a vertical flex item. (Though internally, we do know that it's really + * "auto", and our flex container will correctly use the flex item's + * min-content height as needed in layout.) + */ + +// Given an element ID, this function sets the corresponding +// element's inline-style min-width and min-height explicitly to "auto". +function setElemMinSizesToAuto(aElemId) { + var elem = document.getElementById(aElemId); + + is(elem.style.minWidth, "", "min-width should be initially unset"); + elem.style.minWidth = "auto"; + is(elem.style.minWidth, "auto", "min-width should accept 'auto' value"); + + is(elem.style.minHeight, "", "min-height should be initially unset"); + elem.style.minHeight = "auto"; + is(elem.style.minHeight, "auto", "min-height should accept 'auto' value"); +} + +// Given an element ID, this function compares the corresponding element's +// computed min-width and min-height against expected values. +// (There's an optional final argument, to specify a "todo" expected value for +// the min-height, for cases when we *should* have a particular value, but we +// don't support it yet. In that case, aExpectedMinHeight is the value we +// currently expect to have, and aExpectedMinHeightTodo is the value we really +// *should* have.) +function checkElemMinSizes(aElemId, + aExpectedMinWidth, + aExpectedMinHeight, + aExpectedMinHeightTodo /* optional */) +{ + var elem = document.getElementById(aElemId); + is(window.getComputedStyle(elem, "").minWidth, aExpectedMinWidth, + "checking min-width of " + aElemId); + + is(window.getComputedStyle(elem, "").minHeight, aExpectedMinHeight, + "checking min-height of " + aElemId); + + // Special bonus check, if the *real* expected value is something we don't + // support yet. + if (typeof aExpectedMinHeightTodo != 'undefined') { + todo_is(window.getComputedStyle(elem, "").minHeight, aExpectedMinHeightTodo, + "checking the ultimately-correct min-height of " + aElemId); + } +} + +// This function goes through all the elements we're interested in +// and checks their computed min-sizes against expected values, +// farming out each per-element job to checkElemMinSizes. +function checkAllTheMinSizes() { + // This is the normal part -- generally, the default value of "min-width" + // and "min-height" (auto) computes to "0px". + checkElemMinSizes("non-flex-item", "0px", "0px"); + + // ...but for a flex item in a horizontal flex container, "min-width: auto" + // computes to "min-content". + checkElemMinSizes("horizontal-flex-item", "-moz-min-content", "0px"); + + // ...and for a flex item in a vertical flex container, "min-height: auto" + // computes to "min-content" (except for now, it computes to "0px", because + // we don't support "min-content" on heights yet. We pass "-moz-min-content" + // as the final arg, to get it checked as the "todo" min-height.) + checkElemMinSizes("vertical-flex-item", "0px", "0px", "-moz-min-content"); +} + +// Main test function +function main() { + // First: check that min-sizes are what we expect, with min-size properties + // at their initial value. + checkAllTheMinSizes(); + + // Now, we *explicitly* set min-size properties to "auto"... + var elemIds = [ "non-flex-item", + "horizontal-flex-item", + "vertical-flex-item"]; + elemIds.forEach(setElemMinSizesToAuto); + + // ...and try again (should have the same result): + checkAllTheMinSizes(); +} + +main(); + +</script> +</pre> +</body> +</html>
--- a/mobile/android/config/mozconfigs/android/release +++ b/mobile/android/config/mozconfigs/android/release @@ -1,15 +1,15 @@ . "$topsrcdir/mobile/android/config/mozconfigs/common" # Android ac_add_options --target=arm-linux-androideabi -ac_add_options --enable-updater +ac_add_options --with-branding=mobile/android/branding/beta -ac_add_options --with-branding=mobile/android/branding/beta +ac_add_options --enable-updater export MOZILLA_OFFICIAL=1 export MOZ_TELEMETRY_REPORTING=1 ac_add_options --enable-official-branding . "$topsrcdir/mobile/android/config/mozconfigs/common.override"
--- a/python/mozbuild/mozbuild/base.py +++ b/python/mozbuild/mozbuild/base.py @@ -454,17 +454,17 @@ class MozbuildObject(ProcessExecutionMix append_env[b'MACH'] = '1' params = { 'args': args, 'line_handler': line_handler, 'append_env': append_env, 'explicit_env': explicit_env, 'log_level': logging.INFO, - 'require_unix_environment': True, + 'require_unix_environment': False, 'ensure_exit_code': ensure_exit_code, 'pass_thru': pass_thru, # Make manages its children, so mozprocess doesn't need to bother. # Having mozprocess manage children can also have side-effects when # building on Windows. See bug 796840. 'ignore_children': True, }
--- a/tools/profiler/ProfilerMarkers.h +++ b/tools/profiler/ProfilerMarkers.h @@ -82,17 +82,17 @@ private: void streamPayloadImp(JSStreamWriter& b); private: const char *mCategory; TracingMetadata mMetaData; }; -class gfxASurface; +#include "gfxASurface.h" class ProfilerMarkerImagePayload : public ProfilerMarkerPayload { public: ProfilerMarkerImagePayload(gfxASurface *aImg); protected: virtual void streamPayload(JSStreamWriter& b) { return streamPayloadImp(b); }
--- a/xpcom/glue/nsTArray.h +++ b/xpcom/glue/nsTArray.h @@ -6,16 +6,17 @@ #ifndef nsTArray_h__ #define nsTArray_h__ #include "nsTArrayForwardDeclare.h" #include "mozilla/Alignment.h" #include "mozilla/Assertions.h" #include "mozilla/MemoryReporting.h" +#include "mozilla/Move.h" #include "mozilla/TypeTraits.h" #include <string.h> #include "nsCycleCollectionNoteChild.h" #include "nsAlgorithm.h" #include "nscore.h" #include "nsQuickSort.h" @@ -463,24 +464,24 @@ public: // which zeroes out POD ("plain old data") types such as regular // ints. We don't want that because it can be a performance issue // and people don't expect it; nsTArray should work like a regular // C/C++ array in this respect. new (static_cast<void*>(aE)) E; } // Invoke the copy-constructor in place. template<class A> - static inline void Construct(E* aE, const A& aArg) + static inline void Construct(E* aE, A &&aArg) { typedef typename mozilla::RemoveCV<E>::Type E_NoCV; typedef typename mozilla::RemoveCV<A>::Type A_NoCV; static_assert(!mozilla::IsSame<E_NoCV*, A_NoCV>::value, "For safety, we disallow constructing nsTArray<E> elements " "from E* pointers. See bug 960591."); - new (static_cast<void*>(aE)) E(aArg); + new (static_cast<void*>(aE)) E(mozilla::Forward<A>(aArg)); } // Invoke the destructor in place. static inline void Destruct(E* aE) { aE->~E(); } }; // The default comparator used by nsTArray template<class A, class B> class nsDefaultComparator @@ -1249,16 +1250,30 @@ public: // A variation on the AppendElements method defined above. template<class Item> elem_type* AppendElement(const Item& aItem) { return AppendElements(&aItem, 1); } + // A variation of AppendElement that takes an r-value reference + elem_type* AppendElement(elem_type&& aItem) + { + if (!Alloc::Successful(this->EnsureCapacity(Length() + 1, + sizeof(elem_type)))) + return nullptr; + index_type len = Length(); + elem_type* iter = Elements() + len; + nsTArrayElementTraits<elem_type>::Construct(iter, mozilla::Forward<elem_type>(aItem)); + this->IncrementLength(1); + return iter; + } + + // Append new elements without copy-constructing. This is useful to avoid // temporaries. // @return A pointer to the newly appended elements, or null on OOM. elem_type* AppendElements(size_type aCount) { if (!Alloc::Successful(this->EnsureCapacity(Length() + aCount, sizeof(elem_type)))) return nullptr;