Chromium Code Reviews| Index: Source/core/rendering/RenderBlock.cpp |
| diff --git a/Source/core/rendering/RenderBlock.cpp b/Source/core/rendering/RenderBlock.cpp |
| index 3236fff5313b2a16e790d163ebeb88e54ca2d988..414359a084f79ce2553a04984cca8f5844285b36 100644 |
| --- a/Source/core/rendering/RenderBlock.cpp |
| +++ b/Source/core/rendering/RenderBlock.cpp |
| @@ -3927,6 +3927,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 requires that flex box and grid do not |
| + // support first-line|first-letter, though. |
| + // FIXME: Remove when buttons are implemented with align-items instead |
| + // of flexbox. |
| + return renderObject->isRenderBlockFlow() || renderObject->isRenderButton(); |
| +} |
| + |
| RenderBlock* RenderBlock::firstLineBlock() const |
| { |
| RenderBlock* firstLineBlock = const_cast<RenderBlock*>(this); |
| @@ -3936,15 +3947,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) |
| @@ -3990,21 +3995,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()); |
| @@ -4176,7 +4175,7 @@ void RenderBlock::updateFirstLetter() |
| break; |
| } |
| currChild = currChild->nextSibling(); |
| - } else if (currChild->isReplaced() || currChild->isRenderButton() || currChild->isMenuList()) { |
| + } else if (currChild->isReplaced() || currChild->isRenderButton() || currChild->isMenuList() || !isRenderBlockFlowOrRenderButton(firstLetterBlock)) { |
|
cbiesinger
2014/08/08 03:28:12
I'm confused, why do we want a break here if the f
Manuel Rego
2014/08/08 12:55:27
Yeah, I agree that it's confusing to add this in t
|
| break; |
| } else if (currChild->style()->hasPseudoStyle(FIRST_LETTER) && currChild->canHaveGeneratedChildren()) { |
| // We found a lower-level node with first-letter, which supersedes the higher-level style |