mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 447660 part 1 - Replace the #define DISABLE_FLOAT_BREAKING_IN_COLUMNS with a pref to enable fragmenting of floats inside columns. Set the pref enabled by default in non-RELEASE builds only. r=roc
This commit is contained in:
parent
6851774977
commit
5e7f3b9df5
@ -425,7 +425,8 @@ asserts(0-1) load 592118.html
|
||||
load 594808-1.html
|
||||
load 595435-1.xhtml
|
||||
load 595740-1.html
|
||||
load 600100.xhtml
|
||||
pref(layout.float-fragments-inside-column.enabled,true) asserts(1) load 600100.xhtml # bug 866955
|
||||
pref(layout.float-fragments-inside-column.enabled,false) load 600100.xhtml
|
||||
load 603490-1.html
|
||||
load 603510-1.html
|
||||
load 604314-1.html
|
||||
|
@ -58,8 +58,6 @@ static const int MIN_LINES_NEEDING_CURSOR = 20;
|
||||
|
||||
static const char16_t kDiscCharacter = 0x2022;
|
||||
|
||||
#define DISABLE_FLOAT_BREAKING_IN_COLUMNS
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::css;
|
||||
using namespace mozilla::layout;
|
||||
@ -5862,8 +5860,8 @@ nsBlockFrame::AdjustFloatAvailableSpace(nsBlockReflowState& aState,
|
||||
? NS_UNCONSTRAINEDSIZE
|
||||
: std::max(0, aState.ContentBEnd() - aState.mBCoord);
|
||||
|
||||
#ifdef DISABLE_FLOAT_BREAKING_IN_COLUMNS
|
||||
if (availBSize != NS_UNCONSTRAINEDSIZE &&
|
||||
!aState.GetFlag(BRS_FLOAT_FRAGMENTS_INSIDE_COLUMN_ENABLED) &&
|
||||
nsLayoutUtils::GetClosestFrameOfType(this, nsGkAtoms::columnSetFrame)) {
|
||||
// Tell the float it has unrestricted block-size, so it won't break.
|
||||
// If the float doesn't actually fit in the column it will fail to be
|
||||
@ -5871,7 +5869,6 @@ nsBlockFrame::AdjustFloatAvailableSpace(nsBlockReflowState& aState,
|
||||
// overflow.
|
||||
availBSize = NS_UNCONSTRAINEDSIZE;
|
||||
}
|
||||
#endif
|
||||
|
||||
return LogicalRect(wm, aState.ContentIStart(), aState.ContentBStart(),
|
||||
availISize, availBSize);
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "nsPresContext.h"
|
||||
#include "nsIFrameInlines.h"
|
||||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -24,6 +25,9 @@
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::layout;
|
||||
|
||||
static bool sFloatFragmentsInsideColumnEnabled;
|
||||
static bool sFloatFragmentsInsideColumnPrefCached;
|
||||
|
||||
nsBlockReflowState::nsBlockReflowState(const nsHTMLReflowState& aReflowState,
|
||||
nsPresContext* aPresContext,
|
||||
nsBlockFrame* aFrame,
|
||||
@ -46,6 +50,13 @@ nsBlockReflowState::nsBlockReflowState(const nsHTMLReflowState& aReflowState,
|
||||
mFloatBreakType(NS_STYLE_CLEAR_NONE),
|
||||
mConsumedBSize(aConsumedBSize)
|
||||
{
|
||||
if (!sFloatFragmentsInsideColumnPrefCached) {
|
||||
sFloatFragmentsInsideColumnPrefCached = true;
|
||||
Preferences::AddBoolVarCache(&sFloatFragmentsInsideColumnEnabled,
|
||||
"layout.float-fragments-inside-column.enabled");
|
||||
}
|
||||
SetFlag(BRS_FLOAT_FRAGMENTS_INSIDE_COLUMN_ENABLED, sFloatFragmentsInsideColumnEnabled);
|
||||
|
||||
WritingMode wm = aReflowState.GetWritingMode();
|
||||
SetFlag(BRS_ISFIRSTINFLOW, aFrame->GetPrevInFlow() == nullptr);
|
||||
SetFlag(BRS_ISOVERFLOWCONTAINER, IS_TRUE_OVERFLOW_CONTAINER(aFrame));
|
||||
@ -859,12 +870,13 @@ nsBlockReflowState::FlowAndPlaceFloat(nsIFrame* aFloat)
|
||||
|
||||
// In the case that we're in columns and not splitting floats, we need
|
||||
// to check here that the float's height fit, and if it didn't, bail.
|
||||
// (This code is only for DISABLE_FLOAT_BREAKING_IN_COLUMNS .)
|
||||
// (controlled by the pref "layout.float-fragments-inside-column.enabled")
|
||||
//
|
||||
// Likewise, if none of the float fit, and it needs to be pushed in
|
||||
// its entirety to the next page (NS_FRAME_IS_TRUNCATED or
|
||||
// NS_INLINE_IS_BREAK_BEFORE), we need to do the same.
|
||||
if ((ContentBSize() != NS_UNCONSTRAINEDSIZE &&
|
||||
!GetFlag(BRS_FLOAT_FRAGMENTS_INSIDE_COLUMN_ENABLED) &&
|
||||
adjustedAvailableSpace.BSize(wm) == NS_UNCONSTRAINEDSIZE &&
|
||||
!mustPlaceFloat &&
|
||||
aFloat->BSize(wm) + floatMargin.BStartEnd(wm) >
|
||||
|
@ -32,7 +32,9 @@ class nsOverflowContinuationTracker;
|
||||
#define BRS_ISOVERFLOWCONTAINER 0x00000100
|
||||
// Our mPushedFloats list is stored on the blocks' proptable
|
||||
#define BRS_PROPTABLE_FLOATCLIST 0x00000200
|
||||
#define BRS_LASTFLAG BRS_PROPTABLE_FLOATCLIST
|
||||
// Set when the pref layout.float-fragments-inside-column.enabled is true.
|
||||
#define BRS_FLOAT_FRAGMENTS_INSIDE_COLUMN_ENABLED 0x00000400
|
||||
#define BRS_LASTFLAG BRS_FLOAT_FRAGMENTS_INSIDE_COLUMN_ENABLED
|
||||
|
||||
class nsBlockReflowState {
|
||||
public:
|
||||
|
8
layout/reftests/bugs/563584-6-columns-ref-enabled.html
Normal file
8
layout/reftests/bugs/563584-6-columns-ref-enabled.html
Normal file
@ -0,0 +1,8 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Testcase for float breaking</title>
|
||||
<body style="margin: 0">
|
||||
<div style="position: absolute; top: 0; left: 0; width: 150px; height: 100px; background: blue"></div>
|
||||
<div style="position: absolute; top: 100px; left: 0; width: 75px; height: 125px; background: aqua"></div>
|
||||
<div style="position: absolute; top: 100px; left: 75px; width: 100px; height: 125px; background: fuchsia"></div>
|
||||
<div style="position: absolute; top: 0px; left: 200px; width: 75px; height: 75px; background: aqua"></div>
|
||||
<div style="position: absolute; top: 0; left: 275px; width: 100px; height: 225px; background: fuchsia"></div>
|
@ -742,7 +742,8 @@ fails == 385823-2b.html 385823-2-ref.html
|
||||
== 386014-1c.html 386014-1-ref.html
|
||||
== 386065-1.html 386065-1-ref.html
|
||||
== 386065-2.html about:blank
|
||||
skip-if(B2G) fails == 386147-1.html 386147-1-ref.html # bug 447460
|
||||
test-pref(layout.float-fragments-inside-column.enabled,false) skip-if(B2G) fails == 386147-1.html 386147-1-ref.html
|
||||
test-pref(layout.float-fragments-inside-column.enabled,true) skip-if(B2G) == 386147-1.html 386147-1-ref.html
|
||||
== 386310-1a.html 386310-1-ref.html
|
||||
== 386310-1b.html 386310-1-ref.html
|
||||
== 386310-1c.html 386310-1-ref.html
|
||||
@ -1522,7 +1523,8 @@ skip-if(B2G) == 563584-2.html 563584-2-ref.html
|
||||
skip-if(B2G) == 563584-3.html 563584-3-ref.html
|
||||
skip-if(B2G) == 563584-4.html 563584-4-ref.html
|
||||
== 563584-5.html 563584-5-ref.html
|
||||
== 563584-6-columns.html 563584-6-columns-ref.html
|
||||
test-pref(layout.float-fragments-inside-column.enabled,false) == 563584-6-columns.html 563584-6-columns-ref.html
|
||||
test-pref(layout.float-fragments-inside-column.enabled,true) == 563584-6-columns.html 563584-6-columns-ref-enabled.html
|
||||
skip-if(B2G) == 563584-6-printing.html 563584-6-printing-ref.html
|
||||
skip-if(B2G) == 563584-7.html 563584-7-ref.html
|
||||
# FIXME: It would be nice to have variants of these -8 tests for the
|
||||
|
@ -31,9 +31,11 @@ fails == border-breaking-004-cols.xhtml border-breaking-002-cols.ref.xhtml
|
||||
== content-inserted-008.xhtml content-inserted-001.ref.xhtml
|
||||
== content-inserted-009.xhtml content-inserted-002.ref.xhtml
|
||||
== dynamic-abspos-overflow-01-cols.xhtml dynamic-abspos-overflow-01-cols.ref.xhtml
|
||||
fails == float-clear-000.html float-clear-000.ref.html
|
||||
test-pref(layout.float-fragments-inside-column.enabled,false) fails == float-clear-000.html float-clear-000.ref.html
|
||||
test-pref(layout.float-fragments-inside-column.enabled,true) == float-clear-000.html float-clear-000.ref.html
|
||||
fails == float-clear-001.html float-clear-000.ref.html
|
||||
fails == float-clear-002.html float-clear-000.ref.html
|
||||
test-pref(layout.float-fragments-inside-column.enabled,false) fails == float-clear-002.html float-clear-000.ref.html
|
||||
test-pref(layout.float-fragments-inside-column.enabled,true) == float-clear-002.html float-clear-000.ref.html
|
||||
fails == float-clear-003.html float-clear-000.ref.html
|
||||
== float-clear-000-print.html float-clear-000-print.ref.html
|
||||
== float-clear-001-print.html float-clear-000-print.ref.html
|
||||
|
@ -2247,6 +2247,13 @@ pref("layout.frame_rate.precise", false);
|
||||
// pref to control whether layout warnings that are hit quite often are enabled
|
||||
pref("layout.spammy_warnings.enabled", true);
|
||||
|
||||
// Should we fragment floats inside CSS column layout?
|
||||
#ifdef RELEASE_BUILD
|
||||
pref("layout.float-fragments-inside-column.enabled", false);
|
||||
#else
|
||||
pref("layout.float-fragments-inside-column.enabled", true);
|
||||
#endif
|
||||
|
||||
// Is support for the Web Animations API enabled?
|
||||
#ifdef RELEASE_BUILD
|
||||
pref("dom.animations-api.core.enabled", false);
|
||||
|
Loading…
Reference in New Issue
Block a user