Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1456)

Unified Diff: Source/core/rendering/RenderBlock.cpp

Issue 440233002: [CSS Grid Layout] Ignore ::first-letter pseudo-element (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/css-grid-layout/grid-item-first-letter-valid-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « LayoutTests/fast/css-grid-layout/grid-item-first-letter-valid-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698