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

Side by Side Diff: Source/core/rendering/RenderObject.cpp

Issue 571603003: Convert first letter into a pseudo element. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 1629 matching lines...) Expand 10 before | Expand all | Expand 10 after
1640 if (diff.needsPaintInvalidationLayer() && !hasLayer()) { 1640 if (diff.needsPaintInvalidationLayer() && !hasLayer()) {
1641 diff.clearNeedsPaintInvalidation(); 1641 diff.clearNeedsPaintInvalidation();
1642 diff.setNeedsPaintInvalidationObject(); 1642 diff.setNeedsPaintInvalidationObject();
1643 } 1643 }
1644 1644
1645 return diff; 1645 return diff;
1646 } 1646 }
1647 1647
1648 void RenderObject::setPseudoStyle(PassRefPtr<RenderStyle> pseudoStyle) 1648 void RenderObject::setPseudoStyle(PassRefPtr<RenderStyle> pseudoStyle)
1649 { 1649 {
1650 ASSERT(pseudoStyle->styleType() == BEFORE || pseudoStyle->styleType() == AFT ER); 1650 ASSERT(pseudoStyle->styleType() == BEFORE || pseudoStyle->styleType() == AFT ER || pseudoStyle->styleType() == FIRST_LETTER);
1651 1651
1652 // FIXME: We should consider just making all pseudo items use an inherited s tyle. 1652 // FIXME: We should consider just making all pseudo items use an inherited s tyle.
1653 1653
1654 // Images are special and must inherit the pseudoStyle so the width and heig ht of 1654 // Images are special and must inherit the pseudoStyle so the width and heig ht of
1655 // the pseudo element doesn't change the size of the image. In all other cas es we 1655 // the pseudo element doesn't change the size of the image. In all other cas es we
1656 // can just share the style. 1656 // can just share the style.
1657 // 1657 //
1658 // Quotes are also RenderInline, so we need to create an inherited style to avoid 1658 // Quotes are also RenderInline, so we need to create an inherited style to avoid
1659 // getting an inline with positioning or an invalid display. 1659 // getting an inline with positioning or an invalid display.
1660 // 1660 //
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after
2660 const RenderObject* rendererForFirstLineStyle = renderer; 2660 const RenderObject* rendererForFirstLineStyle = renderer;
2661 if (renderer->isBeforeOrAfterContent()) 2661 if (renderer->isBeforeOrAfterContent())
2662 rendererForFirstLineStyle = renderer->parent(); 2662 rendererForFirstLineStyle = renderer->parent();
2663 2663
2664 if (rendererForFirstLineStyle->isRenderBlockFlow() || rendererForFirstLineSt yle->isRenderButton()) { 2664 if (rendererForFirstLineStyle->isRenderBlockFlow() || rendererForFirstLineSt yle->isRenderButton()) {
2665 if (RenderBlock* firstLineBlock = rendererForFirstLineStyle->firstLineBl ock()) { 2665 if (RenderBlock* firstLineBlock = rendererForFirstLineStyle->firstLineBl ock()) {
2666 if (type == Cached) 2666 if (type == Cached)
2667 return firstLineBlock->getCachedPseudoStyle(FIRST_LINE, style); 2667 return firstLineBlock->getCachedPseudoStyle(FIRST_LINE, style);
2668 return firstLineBlock->getUncachedPseudoStyle(PseudoStyleRequest(FIR ST_LINE), style, firstLineBlock == renderer ? style : 0); 2668 return firstLineBlock->getUncachedPseudoStyle(PseudoStyleRequest(FIR ST_LINE), style, firstLineBlock == renderer ? style : 0);
2669 } 2669 }
2670 } else if (!rendererForFirstLineStyle->isAnonymous() && rendererForFirstLine Style->isRenderInline()) { 2670 } else if (!rendererForFirstLineStyle->isAnonymous() && rendererForFirstLine Style->isRenderInline()
2671 // FIXME: IS this right? Doing this gives us the same behaviour as the n on-pseudoElement first letter ....
dsinclair 2014/09/27 03:21:21 This was a fix for a failing layout test, basicall
esprehn 2014/09/30 09:00:31 Not sure what this is doing, have an example? Also
dsinclair 2014/09/30 21:46:34 Logic cleaned up. For an example, with fast/css/f
2672 && !(rendererForFirstLineStyle->node() && rendererForFirstLineStyle->nod e()->isFirstLetterPseudoElement())) {
2673
2671 RenderStyle* parentStyle = rendererForFirstLineStyle->parent()->firstLin eStyle(); 2674 RenderStyle* parentStyle = rendererForFirstLineStyle->parent()->firstLin eStyle();
2672 if (parentStyle != rendererForFirstLineStyle->parent()->style()) { 2675 if (parentStyle != rendererForFirstLineStyle->parent()->style()) {
2673 if (type == Cached) { 2676 if (type == Cached) {
2674 // A first-line style is in effect. Cache a first-line style for ourselves. 2677 // A first-line style is in effect. Cache a first-line style for ourselves.
2675 rendererForFirstLineStyle->style()->setHasPseudoStyle(FIRST_LINE _INHERITED); 2678 rendererForFirstLineStyle->style()->setHasPseudoStyle(FIRST_LINE _INHERITED);
2676 return rendererForFirstLineStyle->getCachedPseudoStyle(FIRST_LIN E_INHERITED, parentStyle); 2679 return rendererForFirstLineStyle->getCachedPseudoStyle(FIRST_LIN E_INHERITED, parentStyle);
2677 } 2680 }
2678 return rendererForFirstLineStyle->getUncachedPseudoStyle(PseudoStyle Request(FIRST_LINE_INHERITED), parentStyle, style); 2681 return rendererForFirstLineStyle->getUncachedPseudoStyle(PseudoStyle Request(FIRST_LINE_INHERITED), parentStyle, style);
2679 } 2682 }
2680 } 2683 }
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
3184 { 3187 {
3185 if (object1) { 3188 if (object1) {
3186 const blink::RenderObject* root = object1; 3189 const blink::RenderObject* root = object1;
3187 while (root->parent()) 3190 while (root->parent())
3188 root = root->parent(); 3191 root = root->parent();
3189 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3192 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3190 } 3193 }
3191 } 3194 }
3192 3195
3193 #endif 3196 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698