Diff
Modified: trunk/LayoutTests/ChangeLog (197029 => 197030)
--- trunk/LayoutTests/ChangeLog 2016-02-24 17:06:50 UTC (rev 197029)
+++ trunk/LayoutTests/ChangeLog 2016-02-24 17:13:33 UTC (rev 197030)
@@ -1,3 +1,18 @@
+2016-02-24 Zalan Bujtas <za...@apple.com>
+
+ Background of an absolutely positioned inline element inside text-indented parent is positioned statically.
+ https://bugs.webkit.org/show_bug.cgi?id=154019
+
+ Reviewed by Simon Fraser.
+
+ This patch ensures that statically positioned out-of-flow renderers are also text-aligned
+ even when none of the renderers on the first line generate a linebox (so we end up with no bidi runs at all).
+ The fix is to pass IndentTextOrNot information to startAlignedOffsetForLine through updateStaticInlinePositionForChild
+ so that we can compute the left position for this statically positioned out of flow renderer.
+
+ * fast/css3-text/css3-text-indent/text-indent-with-absolute-pos-child-expected.html: Added.
+ * fast/css3-text/css3-text-indent/text-indent-with-absolute-pos-child.html: Added.
+
2016-02-24 Carlos Garcia Campos <cgar...@igalia.com>
REGRESSION(r195949): [GTK] Test /webkit2/WebKitWebView/insert/link is failing since r195949
Added: trunk/LayoutTests/fast/css3-text/css3-text-indent/text-indent-with-absolute-pos-child-expected.html (0 => 197030)
--- trunk/LayoutTests/fast/css3-text/css3-text-indent/text-indent-with-absolute-pos-child-expected.html (rev 0)
+++ trunk/LayoutTests/fast/css3-text/css3-text-indent/text-indent-with-absolute-pos-child-expected.html 2016-02-24 17:13:33 UTC (rev 197030)
@@ -0,0 +1,58 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>This tests that first line text-indent is applied properly when the child is a statically positioned out-of-flow renderer.</title>
+<style>
+ body {
+ margin: 40px;
+ }
+
+.container {
+ display: block;
+ background-color: green;
+ width: 100px;
+ height: 20px;
+ color: green;
+ font-family: Ahem;
+ font-size: 10px;
+}
+
+.inner {
+ display: block;
+ background-color: blue;
+ width: 20px;
+ height: 20px;
+}
+</style>
+</head>
+<body>
+<div>
+<div class=container><div class=inner style="margin-left: 20px;"></div></div>
+<div class=container><div class=inner style="margin-left: 20px;"></div></div>
+<div class=container><div class=inner style="margin-left: 20px;"></div></div>
+<div class=container><div class=inner style="margin-left: 20px;"></div></div>
+<div class=container><div class=inner style="position: relative; left: 70px;"></div></div>
+<div class=container><div class=inner style="margin-left: -20px;"></div></div>
+<div class=container><div class=inner style="left: 40px;"></div></div>
+<div class=container><div class=inner></div></div>
+<div class=container><div class=inner></div></div>
+<div class=container><div class=inner style="position: relative; top: 10px"></div></div>
+<div class=container><div class=inner></div></div>
+</div>
+
+<div style="direction: rtl;">
+<div class=container><div class=inner style="margin-right: 20px;"></div></div>
+<div class=container><div class=inner style="margin-right: 20px;"></div></div>
+<div class=container><div class=inner style="margin-right: 20px;"></div></div>
+<div class=container><div class=inner style="margin-right: 20px;"></div></div>
+<div class=container><div class=inner style="position: relative; right: 70px;"></div></div>
+<div class=container><div class=inner style="margin-right: -20px;"></div></div>
+<div class=container><div class=inner style="right: 40px;"></div></div>
+<div class=container><div class=inner></div></div>
+<div class=container><div class=inner></div></div>
+<div class=container><div class=inner style="position: relative; top: 10px"></div></div>
+<div class=container><div class=inner></div></div>
+</div>
+
+</body>
+</html>
\ No newline at end of file
Added: trunk/LayoutTests/fast/css3-text/css3-text-indent/text-indent-with-absolute-pos-child.html (0 => 197030)
--- trunk/LayoutTests/fast/css3-text/css3-text-indent/text-indent-with-absolute-pos-child.html (rev 0)
+++ trunk/LayoutTests/fast/css3-text/css3-text-indent/text-indent-with-absolute-pos-child.html 2016-02-24 17:13:33 UTC (rev 197030)
@@ -0,0 +1,59 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>This tests that first line text-indent is applied properly when the child is a statically positioned out-of-flow renderer.</title>
+<style>
+ body {
+ margin: 40px;
+ }
+
+.container {
+ display: block;
+ background-color: green;
+ width: 100px;
+ height: 20px;
+ color: green;
+ font-family: Ahem;
+ font-size: 10px;
+}
+
+.inner {
+ display: inline;
+ position: absolute;
+ background-color: blue;
+ width: 20px;
+ height: 20px;
+}
+</style>
+</head>
+<body>
+<div>
+<div class=container style="text-indent: 20px"><div class=inner></div></div>
+<div class=container style="text-indent: 20px"><div class=inner style="display: inline-block;"></div></div>
+<div class=container style="text-indent: 20px"><div class=inner></div>foobar</div>
+<div class=container style="text-indent: 20px"><div class=inner style="text-indent: 20px;">f</div></div>
+<div class=container style="text-indent: 10px">foobar<div class=inner></div></div>
+<div class=container style="text-indent: -20px"><div class=inner></div></div>
+<div class=container style="text-indent: 20px"><div class=inner style="left: 40px;"></div></div>
+<div class=container style="text-indent: 20px"><div class=inner style="display: block;"></div></div>
+<div class=container style="text-indent: 20px"><div class=inner style="position: relative; display: block;"></div></div>
+<div class=container style="text-indent: 20px">foobar<br><div class=inner></div></div>
+<div class=container><div class=inner></div></div>
+</div>
+
+<div style="direction: rtl;">
+<div class=container style="text-indent: 20px"><div class=inner></div></div>
+<div class=container style="text-indent: 20px"><div class=inner style="display: inline-block;"></div></div>
+<div class=container style="text-indent: 20px"><div class=inner></div>foobar</div>
+<div class=container style="text-indent: 20px"><div class=inner style="text-indent: 20px;">f</div></div>
+<div class=container style="text-indent: 10px">foobar<div class=inner></div></div>
+<div class=container style="text-indent: -20px"><div class=inner></div></div>
+<div class=container style="text-indent: 20px"><div class=inner style="right: 40px;"></div></div>
+<div class=container style="text-indent: 20px"><div class=inner style="display: block;"></div></div>
+<div class=container style="text-indent: 20px"><div class=inner style="position: relative; display: block;"></div></div>
+<div class=container style="text-indent: 20px">foobar<br><div class=inner></div></div>
+<div class=container><div class=inner></div></div>
+</div>
+
+</body>
+</html>
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (197029 => 197030)
--- trunk/Source/WebCore/ChangeLog 2016-02-24 17:06:50 UTC (rev 197029)
+++ trunk/Source/WebCore/ChangeLog 2016-02-24 17:13:33 UTC (rev 197030)
@@ -1,3 +1,30 @@
+2016-02-24 Zalan Bujtas <za...@apple.com>
+
+ Background of an absolutely positioned inline element inside text-indented parent is positioned statically.
+ https://bugs.webkit.org/show_bug.cgi?id=154019
+
+ Reviewed by Simon Fraser.
+
+ This patch ensures that statically positioned out-of-flow renderers are also text-aligned
+ even when none of the renderers on the first line generate a linebox (so we end up with no bidi runs at all).
+ The fix is to pass IndentTextOrNot information to startAlignedOffsetForLine through updateStaticInlinePositionForChild
+ so that we can compute the left position for this statically positioned out of flow renderer.
+
+ Test: fast/css3-text/css3-text-indent/text-indent-with-absolute-pos-child.html
+
+ * rendering/RenderBlockFlow.cpp:
+ (WebCore::RenderBlockFlow::adjustPositionedBlock):
+ (WebCore::RenderBlockFlow::updateStaticInlinePositionForChild):
+ * rendering/RenderBlockFlow.h:
+ * rendering/RenderBlockLineLayout.cpp:
+ (WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
+ (WebCore::RenderBlockFlow::startAlignedOffsetForLine):
+ * rendering/line/LineBreaker.cpp:
+ (WebCore::LineBreaker::skipTrailingWhitespace):
+ (WebCore::LineBreaker::skipLeadingWhitespace):
+ * rendering/line/LineInlineHeaders.h: webkit.org/b/154628 fixes the bool vs IndentTextOrNot issue.
+ (WebCore::setStaticPositions):
+
2016-02-24 Youenn Fablet <youenn.fab...@crf.canon.fr>
Remove IteratorKey and IteratorValue declarations from JSXX class declarations.
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (197029 => 197030)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-02-24 17:06:50 UTC (rev 197029)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-02-24 17:13:33 UTC (rev 197030)
@@ -7135,7 +7135,7 @@
FFB698CF183402BB00158A31 /* LineInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FFB698CD1833F17600158A31 /* LineInfo.cpp */; };
FFD5B97A135CC97800D5E92A /* PageVisibilityState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FFD5B977135CC97800D5E92A /* PageVisibilityState.cpp */; };
FFD5B97B135CC97800D5E92A /* PageVisibilityState.h in Headers */ = {isa = PBXBuildFile; fileRef = FFD5B978135CC97800D5E92A /* PageVisibilityState.h */; settings = {ATTRIBUTES = (Private, ); }; };
- FFDBC047183D27B700407109 /* LineWidth.h in Headers */ = {isa = PBXBuildFile; fileRef = FFDBC045183D27B700407109 /* LineWidth.h */; };
+ FFDBC047183D27B700407109 /* LineWidth.h in Headers */ = {isa = PBXBuildFile; fileRef = FFDBC045183D27B700407109 /* LineWidth.h */; settings = {ATTRIBUTES = (Private, ); }; };
FFDBC048183D27B700407109 /* LineWidth.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FFDBC046183D27B700407109 /* LineWidth.cpp */; };
FFEFAB2A18380DA000514534 /* LineLayoutState.h in Headers */ = {isa = PBXBuildFile; fileRef = FFEFAB2918380DA000514534 /* LineLayoutState.h */; };
/* End PBXBuildFile section */
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (197029 => 197030)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2016-02-24 17:06:50 UTC (rev 197029)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2016-02-24 17:13:33 UTC (rev 197030)
@@ -798,7 +798,7 @@
bool hasStaticBlockPosition = child.style().hasStaticBlockPosition(isHorizontal);
LayoutUnit logicalTop = logicalHeight();
- updateStaticInlinePositionForChild(child, logicalTop);
+ updateStaticInlinePositionForChild(child, logicalTop, DoNotIndentText);
if (!marginInfo.canCollapseWithMarginBefore()) {
// Positioned blocks don't collapse margins, so add the margin provided by
@@ -865,10 +865,10 @@
setLogicalHeight(logicalHeight() - marginOffset);
}
-void RenderBlockFlow::updateStaticInlinePositionForChild(RenderBox& child, LayoutUnit logicalTop)
+void RenderBlockFlow::updateStaticInlinePositionForChild(RenderBox& child, LayoutUnit logicalTop, IndentTextOrNot shouldIndentText)
{
if (child.style().isOriginalDisplayInlineType())
- setStaticInlinePositionForChild(child, logicalTop, startAlignedOffsetForLine(logicalTop, false));
+ setStaticInlinePositionForChild(child, logicalTop, startAlignedOffsetForLine(logicalTop, shouldIndentText));
else
setStaticInlinePositionForChild(child, logicalTop, startOffsetForContent(logicalTop));
}
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.h (197029 => 197030)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.h 2016-02-24 17:06:50 UTC (rev 197029)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.h 2016-02-24 17:13:33 UTC (rev 197030)
@@ -24,6 +24,7 @@
#define RenderBlockFlow_h
#include "FloatingObjects.h"
+#include "LineWidth.h"
#include "RenderBlock.h"
#include "RenderLineBoxList.h"
#include "SimpleLineLayout.h"
@@ -246,7 +247,7 @@
void adjustFloatingBlock(const MarginInfo&);
void setStaticInlinePositionForChild(RenderBox& child, LayoutUnit blockOffset, LayoutUnit inlinePosition);
- void updateStaticInlinePositionForChild(RenderBox& child, LayoutUnit logicalTop);
+ void updateStaticInlinePositionForChild(RenderBox& child, LayoutUnit logicalTop, IndentTextOrNot shouldIndentText);
LayoutUnit collapseMargins(RenderBox& child, MarginInfo&);
LayoutUnit collapseMarginsWithChildInfo(RenderBox* child, RenderObject* prevSibling, MarginInfo&);
@@ -543,7 +544,7 @@
static void appendRunsForObject(BidiRunList<BidiRun>*, int start, int end, RenderObject&, InlineBidiResolver&);
RootInlineBox* createAndAppendRootInlineBox();
- LayoutUnit startAlignedOffsetForLine(LayoutUnit position, bool shouldIndentText);
+ LayoutUnit startAlignedOffsetForLine(LayoutUnit position, IndentTextOrNot shouldIndentText);
virtual ETextAlign textAlignmentForLine(bool endsWithSoftBreak) const;
virtual void adjustInlineDirectionLineBounds(int /* expansionOpportunityCount */, float& /* logicalLeft */, float& /* logicalWidth */) const { }
Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (197029 => 197030)
--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2016-02-24 17:06:50 UTC (rev 197029)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2016-02-24 17:13:33 UTC (rev 197030)
@@ -1372,7 +1372,7 @@
}
for (size_t i = 0; i < lineBreaker.positionedObjects().size(); ++i)
- setStaticPositions(*this, *lineBreaker.positionedObjects()[i]);
+ setStaticPositions(*this, *lineBreaker.positionedObjects()[i], DoNotIndentText);
if (!layoutState.lineInfo().isEmpty()) {
layoutState.lineInfo().setFirstLine(false);
@@ -2119,16 +2119,31 @@
return true;
}
-LayoutUnit RenderBlockFlow::startAlignedOffsetForLine(LayoutUnit position, bool firstLine)
+LayoutUnit RenderBlockFlow::startAlignedOffsetForLine(LayoutUnit position, IndentTextOrNot shouldIndentText)
{
ETextAlign textAlign = style().textAlign();
-
+ bool shouldApplyIndentText = false;
+ switch (textAlign) {
+ case LEFT:
+ case WEBKIT_LEFT:
+ shouldApplyIndentText = style().isLeftToRightDirection();
+ break;
+ case RIGHT:
+ case WEBKIT_RIGHT:
+ shouldApplyIndentText = !style().isLeftToRightDirection();
+ break;
+ case TASTART:
+ shouldApplyIndentText = true;
+ break;
+ default:
+ shouldApplyIndentText = false;
+ }
// <rdar://problem/15427571>
// https://bugs.webkit.org/show_bug.cgi?id=124522
// This quirk is for legacy content that doesn't work properly with the center positioning scheme
// being honored (e.g., epubs).
- if (textAlign == TASTART || document().settings()->useLegacyTextAlignPositionedElementBehavior()) // FIXME: Handle TAEND here
- return startOffsetForLine(position, firstLine);
+ if (shouldApplyIndentText || document().settings()->useLegacyTextAlignPositionedElementBehavior()) // FIXME: Handle TAEND here
+ return startOffsetForLine(position, shouldIndentText == IndentText);
// updateLogicalWidthForAlignment() handles the direction of the block so no need to consider it here
float totalLogicalWidth = 0;
Modified: trunk/Source/WebCore/rendering/line/LineBreaker.cpp (197029 => 197030)
--- trunk/Source/WebCore/rendering/line/LineBreaker.cpp 2016-02-24 17:06:50 UTC (rev 197029)
+++ trunk/Source/WebCore/rendering/line/LineBreaker.cpp 2016-02-24 17:13:33 UTC (rev 197030)
@@ -48,7 +48,7 @@
while (!iterator.atEnd() && !requiresLineBox(iterator, lineInfo, TrailingWhitespace)) {
RenderObject& object = *iterator.renderer();
if (object.isOutOfFlowPositioned())
- setStaticPositions(m_block, downcast<RenderBox>(object));
+ setStaticPositions(m_block, downcast<RenderBox>(object), DoNotIndentText);
else if (object.isFloating())
m_block.insertFloatingObject(downcast<RenderBox>(object));
iterator.increment();
@@ -60,7 +60,7 @@
while (!resolver.position().atEnd() && !requiresLineBox(resolver.position(), lineInfo, LeadingWhitespace)) {
RenderObject& object = *resolver.position().renderer();
if (object.isOutOfFlowPositioned()) {
- setStaticPositions(m_block, downcast<RenderBox>(object));
+ setStaticPositions(m_block, downcast<RenderBox>(object), width.shouldIndentText() ? IndentText : DoNotIndentText);
if (object.style().isOriginalDisplayInlineType()) {
resolver.runs().addRun(new BidiRun(0, 1, object, resolver.context(), resolver.dir()));
lineInfo.incrementRunsFromLeadingWhitespace();
Modified: trunk/Source/WebCore/rendering/line/LineInlineHeaders.h (197029 => 197030)
--- trunk/Source/WebCore/rendering/line/LineInlineHeaders.h 2016-02-24 17:06:50 UTC (rev 197029)
+++ trunk/Source/WebCore/rendering/line/LineInlineHeaders.h 2016-02-24 17:13:33 UTC (rev 197030)
@@ -120,7 +120,7 @@
return notJustWhitespace || rendererIsEmptyInline;
}
-inline void setStaticPositions(RenderBlockFlow& block, RenderBox& child)
+inline void setStaticPositions(RenderBlockFlow& block, RenderBox& child, IndentTextOrNot shouldIndentText)
{
// FIXME: The math here is actually not really right. It's a best-guess approximation that
// will work for the common cases
@@ -130,10 +130,10 @@
// A relative positioned inline encloses us. In this case, we also have to determine our
// position as though we were an inline. Set |staticInlinePosition| and |staticBlockPosition| on the relative positioned
// inline so that we can obtain the value later.
- downcast<RenderInline>(*containerBlock).layer()->setStaticInlinePosition(block.startAlignedOffsetForLine(blockHeight, false));
+ downcast<RenderInline>(*containerBlock).layer()->setStaticInlinePosition(block.startAlignedOffsetForLine(blockHeight, DoNotIndentText));
downcast<RenderInline>(*containerBlock).layer()->setStaticBlockPosition(blockHeight);
}
- block.updateStaticInlinePositionForChild(child, blockHeight);
+ block.updateStaticInlinePositionForChild(child, blockHeight, shouldIndentText);
child.layer()->setStaticBlockPosition(blockHeight);
}