Commit f670691e authored by mihnea@adobe.com's avatar mihnea@adobe.com

Add RenderStyle::isPositioned() helper method

https://bugs.webkit.org/show_bug.cgi?id=75959

Reviewed by Tony Chang.

No new tests since this is refactoring of existing code.
Replace (style()->position() == AbsolutePosition || style()->position() == FixedPosition)
with (style()->isPositioned()).
Replace (style()->position() != AbsolutePosition && style()->position() != FixedPosition)
with (!style()->isPositioned()).

* rendering/RenderBox.cpp:
(WebCore::RenderBox::updateBoxModelInfoFromStyle):
(WebCore::RenderBox::offsetFromContainer):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::mapAbsoluteToLocalPoint):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::computeRectForRepaint):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::markContainingBlocksForLayout):
(WebCore::RenderObject::setPreferredLogicalWidthsDirty):
(WebCore::RenderObject::invalidateContainerPreferredLogicalWidths):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyleBitfields::isPositioned):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@104802 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 13c083bf
2012-01-12 Mihnea Ovidenie <mihnea@adobe.com>
Add RenderStyle::isPositioned() helper method
https://bugs.webkit.org/show_bug.cgi?id=75959
Reviewed by Tony Chang.
No new tests since this is refactoring of existing code.
Replace (style()->position() == AbsolutePosition || style()->position() == FixedPosition)
with (style()->isPositioned()).
Replace (style()->position() != AbsolutePosition && style()->position() != FixedPosition)
with (!style()->isPositioned()).
* rendering/RenderBox.cpp:
(WebCore::RenderBox::updateBoxModelInfoFromStyle):
(WebCore::RenderBox::offsetFromContainer):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::mapAbsoluteToLocalPoint):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::computeRectForRepaint):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::markContainingBlocksForLayout):
(WebCore::RenderObject::setPreferredLogicalWidthsDirty):
(WebCore::RenderObject::invalidateContainerPreferredLogicalWidths):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyleBitfields::isPositioned):
2012-01-11 KwangHyuk Kim <hyuki.kim@samsung.com>
[EFL] Rename parameter and variable name 'r' to 'rect' in IntRectEfl.cpp.
......@@ -409,7 +409,7 @@ void RenderBox::updateBoxModelInfoFromStyle()
if (isRootObject || isViewObject)
setHasBoxDecorations(true);
setPositioned(style()->position() == AbsolutePosition || style()->position() == FixedPosition);
setPositioned(style()->isPositioned());
setFloating(style()->isFloating() && (!isPositioned() || style()->floating() == PositionedFloat));
// We also handle <body> and <html>, whose overflow applies to the viewport.
......@@ -1397,7 +1397,7 @@ LayoutSize RenderBox::offsetFromContainer(RenderObject* o, const LayoutPoint& po
offset += relativePositionOffset();
if (!isInline() || isReplaced()) {
if (style()->position() != AbsolutePosition && style()->position() != FixedPosition && o->hasColumns()) {
if (!style()->isPositioned() && o->hasColumns()) {
RenderBlock* block = toRenderBlock(o);
LayoutRect columnRect(frameRect());
block->adjustStartEdgeForWritingModeIncludingColumns(columnRect);
......
......@@ -2759,7 +2759,7 @@ void RenderBoxModelObject::mapAbsoluteToLocalPoint(bool fixed, bool useTransform
LayoutSize containerOffset = offsetFromContainer(o, LayoutPoint());
if (style()->position() != AbsolutePosition && style()->position() != FixedPosition && o->hasColumns()) {
if (!style()->isPositioned() && o->hasColumns()) {
RenderBlock* block = static_cast<RenderBlock*>(o);
LayoutPoint point(roundedLayoutPoint(transformState.mappedPoint()));
point -= containerOffset;
......
......@@ -1053,7 +1053,7 @@ void RenderInline::computeRectForRepaint(RenderBoxModelObject* repaintContainer,
LayoutPoint topLeft = rect.location();
if (o->isBlockFlow() && style()->position() != AbsolutePosition && style()->position() != FixedPosition) {
if (o->isBlockFlow() && !style()->isPositioned()) {
RenderBlock* cb = toRenderBlock(o);
if (cb->hasColumns()) {
LayoutRect repaintRect(topLeft, rect.size());
......
......@@ -626,7 +626,7 @@ void RenderObject::markContainingBlocksForLayout(bool scheduleRelayout, RenderOb
RenderObject* container = object->container();
if (!container && !object->isRenderView())
return;
if (!last->isText() && (last->style()->position() == FixedPosition || last->style()->position() == AbsolutePosition)) {
if (!last->isText() && last->style()->isPositioned()) {
bool willSkipRelativelyPositionedInlines = !object->isRenderBlock();
while (object && !object->isRenderBlock()) // Skip relatively positioned inlines and get to the enclosing RenderBlock.
object = object->container();
......@@ -666,7 +666,7 @@ void RenderObject::setPreferredLogicalWidthsDirty(bool b, bool markParents)
{
bool alreadyDirty = preferredLogicalWidthsDirty();
m_bitfields.setPreferredLogicalWidthsDirty(b);
if (b && !alreadyDirty && markParents && (isText() || (style()->position() != FixedPosition && style()->position() != AbsolutePosition)))
if (b && !alreadyDirty && markParents && (isText() || !style()->isPositioned()))
invalidateContainerPreferredLogicalWidths();
}
......@@ -683,7 +683,7 @@ void RenderObject::invalidateContainerPreferredLogicalWidths()
break;
o->m_bitfields.setPreferredLogicalWidthsDirty(true);
if (o->style()->position() == FixedPosition || o->style()->position() == AbsolutePosition)
if (o->style()->isPositioned())
// A positioned object has no effect on the min/max width of its containing block ever.
// We can optimize this case and not go up any further.
break;
......
......@@ -508,6 +508,7 @@ public:
bool hasStaticBlockPosition(bool horizontal) const { return horizontal ? hasAutoTopAndBottom() : hasAutoLeftAndRight(); }
EPosition position() const { return static_cast<EPosition>(noninherited_flags._position); }
bool isPositioned() const { return position() == AbsolutePosition || position() == FixedPosition; }
EFloat floating() const { return static_cast<EFloat>(noninherited_flags._floating); }
Length width() const { return m_box->width(); }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment