Index: Source/core/rendering/RenderBlock.cpp |
diff --git a/Source/core/rendering/RenderBlock.cpp b/Source/core/rendering/RenderBlock.cpp |
index 4da89dedae2755cf9f5fa57fae19ab65d1b7e706..f78f440c07e86e1768b2eea2967befc172a87ecd 100644 |
--- a/Source/core/rendering/RenderBlock.cpp |
+++ b/Source/core/rendering/RenderBlock.cpp |
@@ -3923,6 +3923,17 @@ int RenderBlock::lastLineBoxBaseline(LineDirectionMode lineDirection) const |
return -1; |
} |
+static inline bool isRenderBlockFlowOrRenderButton(RenderObject* renderObject) |
+{ |
+ // We include isRenderButton in this check because buttons are implemented |
+ // using flex box but should still support first-line|first-letter. |
+ // The flex box and grid specs require that flex box and grid do not |
+ // support first-line|first-letter, though. |
+ // FIXME: Remove when buttons are implemented with align-items instead |
+ // of flex box. |
+ return renderObject->isRenderBlockFlow() || renderObject->isRenderButton(); |
+} |
+ |
RenderBlock* RenderBlock::firstLineBlock() const |
{ |
RenderBlock* firstLineBlock = const_cast<RenderBlock*>(this); |
@@ -3932,15 +3943,9 @@ RenderBlock* RenderBlock::firstLineBlock() const |
if (hasPseudo) |
break; |
RenderObject* parentBlock = firstLineBlock->parent(); |
- // We include isRenderButton in this check because buttons are |
- // implemented using flex box but should still support first-line. The |
- // flex box spec requires that flex box does not support first-line, |
- // though. |
- // FIXME: Remove when buttons are implemented with align-items instead |
- // of flexbox. |
if (firstLineBlock->isReplaced() || firstLineBlock->isFloating() |
|| !parentBlock |
- || (!parentBlock->isRenderBlockFlow() && !parentBlock->isRenderButton())) |
+ || !isRenderBlockFlowOrRenderButton(parentBlock)) |
break; |
ASSERT_WITH_SECURITY_IMPLICATION(parentBlock->isRenderBlock()); |
if (toRenderBlock(parentBlock)->firstChild() != firstLineBlock) |
@@ -3986,21 +3991,15 @@ static inline RenderObject* findFirstLetterBlock(RenderBlock* start) |
{ |
RenderObject* firstLetterBlock = start; |
while (true) { |
- // We include isRenderButton in these two checks because buttons are |
- // implemented using flex box but should still support first-letter. |
- // The flex box spec requires that flex box does not support |
- // first-letter, though. |
- // FIXME: Remove when buttons are implemented with align-items instead |
- // of flexbox. |
bool canHaveFirstLetterRenderer = firstLetterBlock->style()->hasPseudoStyle(FIRST_LETTER) |
&& firstLetterBlock->canHaveGeneratedChildren() |
- && (!firstLetterBlock->isFlexibleBox() || firstLetterBlock->isRenderButton()); |
+ && isRenderBlockFlowOrRenderButton(firstLetterBlock); |
if (canHaveFirstLetterRenderer) |
return firstLetterBlock; |
RenderObject* parentBlock = firstLetterBlock->parent(); |
if (firstLetterBlock->isReplaced() || !parentBlock |
- || (!parentBlock->isRenderBlockFlow() && !parentBlock->isRenderButton())) { |
+ || !isRenderBlockFlowOrRenderButton(parentBlock)) { |
return 0; |
} |
ASSERT(parentBlock->isRenderBlock()); |
@@ -4183,7 +4182,7 @@ void RenderBlock::updateFirstLetter() |
} |
} |
- if (!currChild) |
+ if (!currChild || !isRenderBlockFlowOrRenderButton(firstLetterBlock)) |
return; |
// If the child already has style, then it has already been created, so we just want |