提交 20dd8466 编写于 作者: O Ojan Vafai

Remove border-fit.

This just lets you size an element to it's content. We should
do this in a more generic way or let you override layout
and do it yourself.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/698613002
上级 97565a73
......@@ -221,7 +221,6 @@ static const CSSPropertyID staticComputableProperties[] = {
CSSPropertyWebkitBackgroundComposite,
CSSPropertyWebkitBackgroundOrigin,
CSSPropertyWebkitBackgroundSize,
CSSPropertyWebkitBorderFit,
CSSPropertyWebkitBorderHorizontalSpacing,
CSSPropertyWebkitBorderImage,
CSSPropertyWebkitBorderVerticalSpacing,
......@@ -1805,10 +1804,6 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
if (style->hyphenationString().isNull())
return cssValuePool().createIdentifierValue(CSSValueAuto);
return cssValuePool().createValue(style->hyphenationString(), CSSPrimitiveValue::CSS_STRING);
case CSSPropertyWebkitBorderFit:
if (style->borderFit() == BorderFitBorder)
return cssValuePool().createIdentifierValue(CSSValueBorder);
return cssValuePool().createIdentifierValue(CSSValueLines);
case CSSPropertyImageRendering:
return CSSPrimitiveValue::create(style->imageRendering());
case CSSPropertyIsolation:
......
......@@ -3399,36 +3399,6 @@ template<> inline CSSPrimitiveValue::operator EBorderCollapse() const
return BSEPARATE;
}
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBorderFit e)
: CSSValue(PrimitiveClass)
{
m_primitiveUnitType = CSS_VALUE_ID;
switch (e) {
case BorderFitBorder:
m_value.valueID = CSSValueBorder;
break;
case BorderFitLines:
m_value.valueID = CSSValueLines;
break;
}
}
template<> inline CSSPrimitiveValue::operator EBorderFit() const
{
ASSERT(isValueID());
switch (m_value.valueID) {
case CSSValueBorder:
return BorderFitBorder;
case CSSValueLines:
return BorderFitLines;
default:
break;
}
ASSERT_NOT_REACHED();
return BorderFitLines;
}
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EImageRendering e)
: CSSValue(PrimitiveClass)
{
......
......@@ -252,7 +252,6 @@ vertical-align animatable, custom_inherit, custom_value
-webkit-background-composite custom_all
-webkit-background-origin use_handlers_for=CSSPropertyBackgroundOrigin
-webkit-background-size animatable, use_handlers_for=CSSPropertyBackgroundSize
-webkit-border-fit
-webkit-border-horizontal-spacing animatable, inherited, name_for_methods=HorizontalBorderSpacing, converter=convertComputedLength<short>
-webkit-border-image initial=initialNinePieceImage, custom_value
-webkit-border-vertical-spacing animatable, inherited, name_for_methods=VerticalBorderSpacing, converter=convertComputedLength<short>
......
......@@ -568,11 +568,6 @@ cover
logical
visual
//
// -webkit-border-fit
//
lines
//
// animation-direction
//
......
......@@ -462,8 +462,6 @@ bool isValidKeywordPropertyAndValue(CSSPropertyID propertyId, CSSValueID valueID
|| valueID == CSSValueDarken || valueID == CSSValueLighten || valueID == CSSValueColorDodge || valueID == CSSValueColorBurn
|| valueID == CSSValueHardLight || valueID == CSSValueSoftLight || valueID == CSSValueDifference || valueID == CSSValueExclusion
|| valueID == CSSValueHue || valueID == CSSValueSaturation || valueID == CSSValueColor || valueID == CSSValueLuminosity;
case CSSPropertyWebkitBorderFit:
return valueID == CSSValueBorder || valueID == CSSValueLines;
case CSSPropertyWebkitBoxDecorationBreak:
return valueID == CSSValueClone || valueID == CSSValueSlice;
case CSSPropertyAlignContent:
......@@ -570,7 +568,6 @@ bool isKeywordPropertyID(CSSPropertyID propertyId)
case CSSPropertyWebkitBorderAfterStyle:
case CSSPropertyWebkitBorderBeforeStyle:
case CSSPropertyWebkitBorderEndStyle:
case CSSPropertyWebkitBorderFit:
case CSSPropertyWebkitBorderStartStyle:
case CSSPropertyWebkitBoxDecorationBreak:
case CSSPropertyAlignContent:
......
......@@ -226,8 +226,6 @@ void RenderBlockFlow::layoutBlock(bool relayoutChildren)
while (!done)
done = layoutBlockFlow(relayoutChildren, layoutScope);
fitBorderToLinesIfNeeded();
updateLayerTransformAfterLayout();
// Update our scroll information if we're overflow:auto/scroll/hidden now that we know if
......@@ -1274,58 +1272,6 @@ bool RenderBlockFlow::hitTestFloats(const HitTestRequest& request, HitTestResult
return false;
}
void RenderBlockFlow::adjustForBorderFit(LayoutUnit x, LayoutUnit& left, LayoutUnit& right) const
{
// We don't deal with relative positioning. Our assumption is that you shrink to fit the lines without accounting
// for either overflow or translations via relative positioning.
if (childrenInline()) {
for (RootInlineBox* box = firstRootBox(); box; box = box->nextRootBox()) {
if (box->firstChild())
left = std::min(left, x + static_cast<LayoutUnit>(box->firstChild()->x()));
if (box->lastChild())
right = std::max(right, x + static_cast<LayoutUnit>(ceilf(box->lastChild()->logicalRight())));
}
} else {
for (RenderBox* obj = firstChildBox(); obj; obj = obj->nextSiblingBox()) {
if (!obj->isFloatingOrOutOfFlowPositioned()) {
if (obj->isRenderBlockFlow() && !obj->hasOverflowClip()) {
toRenderBlockFlow(obj)->adjustForBorderFit(x + obj->x(), left, right);
} else {
// We are a replaced element or some kind of non-block-flow object.
left = std::min(left, x + obj->x());
right = std::max(right, x + obj->x() + obj->width());
}
}
}
}
}
void RenderBlockFlow::fitBorderToLinesIfNeeded()
{
if (style()->borderFit() == BorderFitBorder || hasOverrideWidth())
return;
// Walk any normal flow lines to snugly fit.
LayoutUnit left = LayoutUnit::max();
LayoutUnit right = LayoutUnit::min();
LayoutUnit oldWidth = contentWidth();
adjustForBorderFit(0, left, right);
// Clamp to our existing edges. We can never grow. We only shrink.
LayoutUnit leftEdge = borderLeft() + paddingLeft();
LayoutUnit rightEdge = leftEdge + oldWidth;
left = std::min(rightEdge, std::max(leftEdge, left));
right = std::max(left, std::min(rightEdge, right));
LayoutUnit newContentWidth = right - left;
if (newContentWidth == oldWidth)
return;
setOverrideLogicalContentWidth(newContentWidth);
layoutBlock(false);
clearOverrideLogicalContentWidth();
}
LayoutUnit RenderBlockFlow::logicalLeftFloatOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, LayoutUnit logicalHeight) const
{
// FIXME(sky): remove this.
......
......@@ -195,9 +195,6 @@ private:
LayoutUnit adjustLogicalRightOffsetForLine(LayoutUnit offsetFromFloats, bool applyTextIndent) const;
LayoutUnit adjustLogicalLeftOffsetForLine(LayoutUnit offsetFromFloats, bool applyTextIndent) const;
void fitBorderToLinesIfNeeded(); // Shrink the box in which the border paints if border-fit is set.
void adjustForBorderFit(LayoutUnit x, LayoutUnit& left, LayoutUnit& right) const; // Helper function for borderFitAdjust
virtual RootInlineBox* createRootInlineBox(); // Subclassed by SVG
void updateLogicalWidthForAlignment(const ETextAlign&, const RootInlineBox*, BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float& availableLogicalWidth, unsigned expansionOpportunityCount);
......
......@@ -1780,7 +1780,7 @@ void RenderBox::computeLogicalWidth(LogicalExtentComputedValues& computedValues)
// width. Use the width from the style context.
// FIXME: Account for block-flow in flexible boxes.
// https://bugs.webkit.org/show_bug.cgi?id=46418
if (hasOverrideWidth() && (style()->borderFit() == BorderFitLines || parent()->isFlexibleBox())) {
if (hasOverrideWidth() && parent()->isFlexibleBox()) {
computedValues.m_extent = overrideLogicalContentWidth() + borderAndPaddingLogicalWidth();
return;
}
......
......@@ -1364,8 +1364,6 @@ const char* RenderObject::invalidationReasonToString(InvalidationReason reason)
return "incremental";
case InvalidationFull:
return "full";
case InvalidationBorderFitLines:
return "border fit lines";
case InvalidationBorderBoxChange:
return "border box change";
case InvalidationBoundsChange:
......@@ -1445,10 +1443,6 @@ InvalidationReason RenderObject::getPaintInvalidationReason(const RenderLayerMod
if (shouldDoFullPaintInvalidation())
return InvalidationFull;
// Presumably a background or a border exists if border-fit:lines was specified.
if (style()->borderFit() == BorderFitLines)
return InvalidationBorderFitLines;
if (compositingState() != PaintsIntoOwnBacking && newLocation != oldLocation)
return InvalidationLocationChange;
......
......@@ -114,7 +114,6 @@ enum InvalidationReason {
InvalidationNone,
InvalidationIncremental,
InvalidationFull,
InvalidationBorderFitLines,
InvalidationBorderBoxChange,
InvalidationBoundsChange,
InvalidationLocationChange,
......
......@@ -502,7 +502,6 @@ bool RenderStyle::diffNeedsPaintInvalidationObject(const RenderStyle& other) con
if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) {
if (rareNonInheritedData->userDrag != other.rareNonInheritedData->userDrag
|| rareNonInheritedData->m_borderFit != other.rareNonInheritedData->m_borderFit
|| rareNonInheritedData->m_objectFit != other.rareNonInheritedData->m_objectFit
|| rareNonInheritedData->m_objectPosition != other.rareNonInheritedData->m_objectPosition
|| !dataEquivalent(rareNonInheritedData->m_shapeOutside, other.rareNonInheritedData->m_shapeOutside)
......
......@@ -757,7 +757,6 @@ public:
const AtomicString& highlight() const { return rareInheritedData->highlight; }
const AtomicString& hyphenationString() const { return rareInheritedData->hyphenationString; }
const AtomicString& locale() const { return rareInheritedData->locale; }
EBorderFit borderFit() const { return static_cast<EBorderFit>(rareNonInheritedData->m_borderFit); }
EResize resize() const { return static_cast<EResize>(rareInheritedData->resize); }
bool hasInlineTransform() const { return rareNonInheritedData->m_hasInlineTransform; }
const TransformOperations& transform() const { return rareNonInheritedData->m_transform->m_operations; }
......@@ -1176,7 +1175,6 @@ public:
void setHyphens(Hyphens h) { SET_VAR(rareInheritedData, hyphens, h); }
void setHyphenationString(const AtomicString& h) { SET_VAR(rareInheritedData, hyphenationString, h); }
void setLocale(const AtomicString& locale) { SET_VAR(rareInheritedData, locale, locale); }
void setBorderFit(EBorderFit b) { SET_VAR(rareNonInheritedData, m_borderFit, b); }
void setResize(EResize r) { SET_VAR(rareInheritedData, resize, r); }
void setHasInlineTransform(bool b) { SET_VAR(rareNonInheritedData, m_hasInlineTransform, b); }
void setTransform(const TransformOperations& ops) { SET_VAR(rareNonInheritedData.access()->m_transform, m_operations, ops); }
......@@ -1426,7 +1424,6 @@ public:
static ESpeak initialSpeak() { return SpeakNormal; }
static const AtomicString& initialHyphenationString() { return nullAtom; }
static const AtomicString& initialLocale() { return nullAtom; }
static EBorderFit initialBorderFit() { return BorderFitBorder; }
static EResize initialResize() { return RESIZE_NONE; }
static bool initialHasAspectRatio() { return false; }
static float initialAspectRatioDenominator() { return 1; }
......
......@@ -272,8 +272,6 @@ enum EListStyleType {
NoneListStyle
};
enum EBorderFit { BorderFitBorder, BorderFitLines };
enum EAnimPlayState {
AnimPlayStatePlaying,
AnimPlayStatePaused
......
......@@ -61,7 +61,6 @@ StyleRareNonInheritedData::StyleRareNonInheritedData()
, textOverflow(RenderStyle::initialTextOverflow())
, marginBeforeCollapse(MCOLLAPSE)
, marginAfterCollapse(MCOLLAPSE)
, m_borderFit(RenderStyle::initialBorderFit())
, m_textDecorationStyle(RenderStyle::initialTextDecorationStyle())
, m_wrapFlow(RenderStyle::initialWrapFlow())
, m_wrapThrough(RenderStyle::initialWrapThrough())
......@@ -131,7 +130,6 @@ StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonInherited
, textOverflow(o.textOverflow)
, marginBeforeCollapse(o.marginBeforeCollapse)
, marginAfterCollapse(o.marginAfterCollapse)
, m_borderFit(o.m_borderFit)
, m_textDecorationStyle(o.m_textDecorationStyle)
, m_wrapFlow(o.m_wrapFlow)
, m_wrapThrough(o.m_wrapThrough)
......@@ -204,7 +202,6 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c
&& textOverflow == o.textOverflow
&& marginBeforeCollapse == o.marginBeforeCollapse
&& marginAfterCollapse == o.marginAfterCollapse
&& m_borderFit == o.m_borderFit
&& m_textDecorationStyle == o.m_textDecorationStyle
&& m_wrapFlow == o.m_wrapFlow
&& m_wrapThrough == o.m_wrapThrough
......
......@@ -145,7 +145,6 @@ public:
unsigned textOverflow : 1; // Whether or not lines that spill out should be truncated with "..."
unsigned marginBeforeCollapse : 2; // EMarginCollapse
unsigned marginAfterCollapse : 2; // EMarginCollapse
unsigned m_borderFit : 1; // EBorderFit
unsigned m_textDecorationStyle : 3; // TextDecorationStyle
unsigned m_wrapFlow: 3; // WrapFlow
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册