summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/RenderBlock.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/rendering/RenderBlock.cpp')
-rwxr-xr-xSource/WebCore/rendering/RenderBlock.cpp136
1 files changed, 103 insertions, 33 deletions
diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp
index 31e640796..796156a60 100755
--- a/Source/WebCore/rendering/RenderBlock.cpp
+++ b/Source/WebCore/rendering/RenderBlock.cpp
@@ -62,7 +62,7 @@
#include "TransformState.h"
#include <wtf/StdLibExtras.h>
#if ENABLE(CSS_EXCLUSIONS)
-#include "WrapShapeInfo.h"
+#include "ExclusionShapeInsideInfo.h"
#endif
using namespace std;
@@ -279,7 +279,7 @@ void RenderBlock::willBeDestroyed()
lineGridBox()->destroy(renderArena());
#if ENABLE(CSS_EXCLUSIONS)
- WrapShapeInfo::removeWrapShapeInfoForRenderBlock(this);
+ ExclusionShapeInsideInfo::removeExclusionShapeInsideInfoForRenderBlock(this);
#endif
if (UNLIKELY(gDelayedUpdateScrollInfoSet != 0))
@@ -328,9 +328,9 @@ void RenderBlock::styleDidChange(StyleDifference diff, const RenderStyle* oldSty
RenderBox::styleDidChange(diff, oldStyle);
#if ENABLE(CSS_EXCLUSIONS)
- // FIXME: Bug 89993: Style changes should affect the WrapShapeInfos for other render blocks that
- // share the same WrapShapeInfo
- updateWrapShapeInfoAfterStyleChange(style()->wrapShapeInside(), oldStyle ? oldStyle->wrapShapeInside() : 0);
+ // FIXME: Bug 89993: Style changes should affect the ExclusionShapeInsideInfos for other render blocks that
+ // share the same ExclusionShapeInsideInfo
+ updateExclusionShapeInsideInfoAfterStyleChange(style()->shapeInside(), oldStyle ? oldStyle->shapeInside() : 0);
#endif
if (!isAnonymousBlock()) {
@@ -1355,6 +1355,15 @@ void RenderBlock::finishDelayUpdateScrollInfo()
void RenderBlock::updateScrollInfoAfterLayout()
{
if (hasOverflowClip()) {
+ if (style()->isFlippedBlocksWritingMode()) {
+ // FIXME: https://bugs.webkit.org/show_bug.cgi?id=97937
+ // Workaround for now. We cannot delay the scroll info for overflow
+ // for items with opposite writing directions, as the contents needs
+ // to overflow in that direction
+ layer()->updateScrollInfoAfterLayout();
+ return;
+ }
+
if (gDelayUpdateScrollInfo)
gDelayedUpdateScrollInfoSet->add(this);
else
@@ -1380,24 +1389,24 @@ void RenderBlock::layout()
}
#if ENABLE(CSS_EXCLUSIONS)
-void RenderBlock::updateWrapShapeInfoAfterStyleChange(const BasicShape* wrapShape, const BasicShape* oldWrapShape)
+void RenderBlock::updateExclusionShapeInsideInfoAfterStyleChange(const BasicShape* shapeInside, const BasicShape* oldShapeInside)
{
// FIXME: A future optimization would do a deep comparison for equality.
- if (wrapShape == oldWrapShape)
+ if (shapeInside == oldShapeInside)
return;
- if (wrapShape) {
- WrapShapeInfo* wrapShapeInfo = WrapShapeInfo::ensureWrapShapeInfoForRenderBlock(this);
- wrapShapeInfo->dirtyWrapShapeSize();
+ if (shapeInside) {
+ ExclusionShapeInsideInfo* exclusionShapeInsideInfo = ExclusionShapeInsideInfo::ensureExclusionShapeInsideInfoForRenderBlock(this);
+ exclusionShapeInsideInfo->dirtyShapeSize();
} else
- WrapShapeInfo::removeWrapShapeInfoForRenderBlock(this);
+ ExclusionShapeInsideInfo::removeExclusionShapeInsideInfoForRenderBlock(this);
}
#endif
void RenderBlock::updateRegionsAndExclusionsLogicalSize()
{
#if ENABLE(CSS_EXCLUSIONS)
- if (!inRenderFlowThread() && !wrapShapeInfo())
+ if (!inRenderFlowThread() && !exclusionShapeInsideInfo())
#else
if (!inRenderFlowThread())
#endif
@@ -1426,10 +1435,10 @@ void RenderBlock::updateRegionsAndExclusionsLogicalSize()
#if ENABLE(CSS_EXCLUSIONS)
void RenderBlock::computeExclusionShapeSize()
{
- WrapShapeInfo* wrapShapeInfo = this->wrapShapeInfo();
- if (wrapShapeInfo) {
+ ExclusionShapeInsideInfo* exclusionShapeInsideInfo = this->exclusionShapeInsideInfo();
+ if (exclusionShapeInsideInfo) {
bool percentageLogicalHeightResolvable = percentageLogicalHeightIsResolvableFromBlock(this, false);
- wrapShapeInfo->computeShapeSize(logicalWidth(), percentageLogicalHeightResolvable ? logicalHeight() : ZERO_LAYOUT_UNIT);
+ exclusionShapeInsideInfo->computeShapeSize(logicalWidth(), percentageLogicalHeightResolvable ? logicalHeight() : ZERO_LAYOUT_UNIT);
}
}
#endif
@@ -1534,14 +1543,6 @@ void RenderBlock::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeigh
setMarginBeforeQuirk(styleToUse->marginBefore().quirk());
setMarginAfterQuirk(styleToUse->marginAfter().quirk());
-
- Node* n = node();
- if (n && n->hasTagName(formTag) && static_cast<HTMLFormElement*>(n)->isMalformed()) {
- // See if this form is malformed (i.e., unclosed). If so, don't give the form
- // a bottom margin.
- setMaxMarginAfterValues(0, 0);
- }
-
setPaginationStrut(0);
}
@@ -3249,7 +3250,7 @@ bool RenderBlock::isSelectionRoot() const
return false;
}
-GapRects RenderBlock::selectionGapRectsForRepaint(RenderBoxModelObject* repaintContainer)
+GapRects RenderBlock::selectionGapRectsForRepaint(RenderLayerModelObject* repaintContainer)
{
ASSERT(!needsLayout());
@@ -4428,7 +4429,7 @@ void RenderBlock::clearFloats()
RendererToFloatInfoMap::iterator end = floatMap.end();
for (RendererToFloatInfoMap::iterator it = floatMap.begin(); it != end; ++it) {
- FloatingObject* floatingObject = (*it).second;
+ FloatingObject* floatingObject = (*it).value;
if (!floatingObject->isDescendant()) {
changeLogicalTop = 0;
changeLogicalBottom = max(changeLogicalBottom, logicalBottomForFloat(floatingObject));
@@ -5784,6 +5785,7 @@ void RenderBlock::computeInlinePreferredLogicalWidths()
bool addedTextIndent = false; // Only gets added in once.
LayoutUnit textIndent = minimumValueForLength(styleToUse->textIndent(), cw, view());
RenderObject* prevFloat = 0;
+ bool isPrevChildInlineFlow = false;
while (RenderObject* child = childIterator.next()) {
autoWrap = child->isReplaced() ? child->parent()->style()->autoWrap() :
child->style()->autoWrap();
@@ -5872,7 +5874,7 @@ void RenderBlock::computeInlinePreferredLogicalWidths()
clearPreviousFloat = false;
bool canBreakReplacedElement = !child->isImage() || allowImagesToBreak;
- if ((canBreakReplacedElement && (autoWrap || oldAutoWrap)) || clearPreviousFloat) {
+ if ((canBreakReplacedElement && (autoWrap || oldAutoWrap) && !isPrevChildInlineFlow) || clearPreviousFloat) {
updatePreferredWidth(m_minPreferredLogicalWidth, inlineMin);
inlineMin = 0;
}
@@ -5899,7 +5901,7 @@ void RenderBlock::computeInlinePreferredLogicalWidths()
// Add our width to the max.
inlineMax += max<float>(0, childMax);
- if (!autoWrap || !canBreakReplacedElement) {
+ if (!autoWrap || !canBreakReplacedElement || isPrevChildInlineFlow) {
if (child->isFloating())
updatePreferredWidth(m_minPreferredLogicalWidth, childMin);
else
@@ -5912,6 +5914,11 @@ void RenderBlock::computeInlinePreferredLogicalWidths()
inlineMin = 0;
}
+ if (autoWrap && canBreakReplacedElement && isPrevChildInlineFlow) {
+ updatePreferredWidth(m_minPreferredLogicalWidth, inlineMin);
+ inlineMin = 0;
+ }
+
// We are no longer stripping whitespace at the start of
// a line.
if (!child->isFloating()) {
@@ -6026,6 +6033,11 @@ void RenderBlock::computeInlinePreferredLogicalWidths()
addedTextIndent = true;
}
+ if (!child->isText() && child->isRenderInline())
+ isPrevChildInlineFlow = true;
+ else
+ isPrevChildInlineFlow = false;
+
oldAutoWrap = autoWrap;
}
@@ -6763,13 +6775,13 @@ void RenderBlock::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const
// https://bugs.webkit.org/show_bug.cgi?id=46781
FloatRect localRect(0, -collapsedMarginBefore(),
width(), height() + collapsedMarginBefore() + collapsedMarginAfter());
- quads.append(localToAbsoluteQuad(localRect, false, wasFixed));
+ quads.append(localToAbsoluteQuad(localRect, 0 /* mode */, wasFixed));
continuation()->absoluteQuads(quads, wasFixed);
} else
- quads.append(RenderBox::localToAbsoluteQuad(FloatRect(0, 0, width(), height()), false, wasFixed));
+ quads.append(RenderBox::localToAbsoluteQuad(FloatRect(0, 0, width(), height()), 0 /* mode */, wasFixed));
}
-LayoutRect RenderBlock::rectWithOutlineForRepaint(RenderBoxModelObject* repaintContainer, LayoutUnit outlineWidth) const
+LayoutRect RenderBlock::rectWithOutlineForRepaint(RenderLayerModelObject* repaintContainer, LayoutUnit outlineWidth) const
{
LayoutRect r(RenderBox::rectWithOutlineForRepaint(repaintContainer, outlineWidth));
if (isAnonymousBlockContinuation())
@@ -7524,7 +7536,23 @@ void RenderBlock::FloatingObjects::computePlacedFloatsTree()
}
}
-TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const UChar* characters, int length, RenderStyle* style, TextRun::ExpansionBehavior expansion, TextRunFlags flags)
+template <typename CharacterType>
+static inline TextRun constructTextRunInternal(RenderObject* context, const Font& font, const CharacterType* characters, int length, RenderStyle* style, TextRun::ExpansionBehavior expansion)
+{
+ ASSERT(style);
+
+ TextDirection textDirection = LTR;
+ bool directionalOverride = style->rtlOrdering() == VisualOrder;
+
+ TextRun run(characters, length, 0, 0, expansion, textDirection, directionalOverride);
+ if (textRunNeedsRenderingContext(font))
+ run.setRenderingContext(SVGTextRunRenderingContext::create(context));
+
+ return run;
+}
+
+template <typename CharacterType>
+static inline TextRun constructTextRunInternal(RenderObject* context, const Font& font, const CharacterType* characters, int length, RenderStyle* style, TextRun::ExpansionBehavior expansion, TextRunFlags flags)
{
ASSERT(style);
@@ -7536,7 +7564,6 @@ TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, c
if (flags & RespectDirectionOverride)
directionalOverride |= isOverride(style->unicodeBidi());
}
-
TextRun run(characters, length, 0, 0, expansion, textDirection, directionalOverride);
if (textRunNeedsRenderingContext(font))
run.setRenderingContext(SVGTextRunRenderingContext::create(context));
@@ -7544,9 +7571,52 @@ TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, c
return run;
}
+#if ENABLE(8BIT_TEXTRUN)
+TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const LChar* characters, int length, RenderStyle* style, TextRun::ExpansionBehavior expansion)
+{
+ return constructTextRunInternal(context, font, characters, length, style, expansion);
+}
+#endif
+
+TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const UChar* characters, int length, RenderStyle* style, TextRun::ExpansionBehavior expansion)
+{
+ return constructTextRunInternal(context, font, characters, length, style, expansion);
+}
+
+TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const RenderText* text, RenderStyle* style, TextRun::ExpansionBehavior expansion)
+{
+#if ENABLE(8BIT_TEXTRUN)
+ if (text->is8Bit())
+ return constructTextRunInternal(context, font, text->characters8(), text->textLength(), style, expansion);
+ return constructTextRunInternal(context, font, text->characters16(), text->textLength(), style, expansion);
+#else
+ return constructTextRunInternal(context, font, text->characters(), text->textLength(), style, expansion);
+#endif
+}
+
+TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const RenderText* text, unsigned offset, unsigned length, RenderStyle* style, TextRun::ExpansionBehavior expansion)
+{
+ ASSERT(offset + length <= text->textLength());
+#if ENABLE(8BIT_TEXTRUN)
+ if (text->is8Bit())
+ return constructTextRunInternal(context, font, text->characters8() + offset, length, style, expansion);
+ return constructTextRunInternal(context, font, text->characters16() + offset, length, style, expansion);
+#else
+ return constructTextRunInternal(context, font, text->characters() + offset, length, style, expansion);
+#endif
+}
+
TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const String& string, RenderStyle* style, TextRun::ExpansionBehavior expansion, TextRunFlags flags)
{
- return constructTextRun(context, font, string.characters(), string.length(), style, expansion, flags);
+ unsigned length = string.length();
+
+#if ENABLE(8BIT_TEXTRUN)
+ if (length && string.is8Bit())
+ return constructTextRunInternal(context, font, string.characters8(), length, style, expansion, flags);
+ return constructTextRunInternal(context, font, string.characters(), length, style, expansion, flags);
+#else
+ return constructTextRunInternal(context, font, string.characters(), length, style, expansion, flags);
+#endif
}
RenderBlock* RenderBlock::createAnonymousWithParentRendererAndDisplay(const RenderObject* parent, EDisplay display)