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

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 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after
1615 if (diff.needsPaintInvalidationLayer() && !hasLayer()) { 1615 if (diff.needsPaintInvalidationLayer() && !hasLayer()) {
1616 diff.clearNeedsPaintInvalidation(); 1616 diff.clearNeedsPaintInvalidation();
1617 diff.setNeedsPaintInvalidationObject(); 1617 diff.setNeedsPaintInvalidationObject();
1618 } 1618 }
1619 1619
1620 return diff; 1620 return diff;
1621 } 1621 }
1622 1622
1623 void RenderObject::setPseudoStyle(PassRefPtr<RenderStyle> pseudoStyle) 1623 void RenderObject::setPseudoStyle(PassRefPtr<RenderStyle> pseudoStyle)
1624 { 1624 {
1625 ASSERT(pseudoStyle->styleType() == BEFORE || pseudoStyle->styleType() == AFT ER); 1625 ASSERT(pseudoStyle->styleType() == BEFORE || pseudoStyle->styleType() == AFT ER || pseudoStyle->styleType() == FIRST_LETTER);
1626 1626
1627 // FIXME: We should consider just making all pseudo items use an inherited s tyle. 1627 // FIXME: We should consider just making all pseudo items use an inherited s tyle.
1628 1628
1629 // Images are special and must inherit the pseudoStyle so the width and heig ht of 1629 // Images are special and must inherit the pseudoStyle so the width and heig ht of
1630 // the pseudo element doesn't change the size of the image. In all other cas es we 1630 // the pseudo element doesn't change the size of the image. In all other cas es we
1631 // can just share the style. 1631 // can just share the style.
1632 // 1632 //
1633 // Quotes are also RenderInline, so we need to create an inherited style to avoid 1633 // Quotes are also RenderInline, so we need to create an inherited style to avoid
1634 // getting an inline with positioning or an invalid display. 1634 // getting an inline with positioning or an invalid display.
1635 // 1635 //
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after
2637 const RenderObject* rendererForFirstLineStyle = renderer; 2637 const RenderObject* rendererForFirstLineStyle = renderer;
2638 if (renderer->isBeforeOrAfterContent()) 2638 if (renderer->isBeforeOrAfterContent())
2639 rendererForFirstLineStyle = renderer->parent(); 2639 rendererForFirstLineStyle = renderer->parent();
2640 2640
2641 if (rendererForFirstLineStyle->isRenderBlockFlow() || rendererForFirstLineSt yle->isRenderButton()) { 2641 if (rendererForFirstLineStyle->isRenderBlockFlow() || rendererForFirstLineSt yle->isRenderButton()) {
2642 if (RenderBlock* firstLineBlock = rendererForFirstLineStyle->firstLineBl ock()) { 2642 if (RenderBlock* firstLineBlock = rendererForFirstLineStyle->firstLineBl ock()) {
2643 if (type == Cached) 2643 if (type == Cached)
2644 return firstLineBlock->getCachedPseudoStyle(FIRST_LINE, style); 2644 return firstLineBlock->getCachedPseudoStyle(FIRST_LINE, style);
2645 return firstLineBlock->getUncachedPseudoStyle(PseudoStyleRequest(FIR ST_LINE), style, firstLineBlock == renderer ? style : 0); 2645 return firstLineBlock->getUncachedPseudoStyle(PseudoStyleRequest(FIR ST_LINE), style, firstLineBlock == renderer ? style : 0);
2646 } 2646 }
2647 } else if (!rendererForFirstLineStyle->isAnonymous() && rendererForFirstLine Style->isRenderInline()) { 2647 } else if (!rendererForFirstLineStyle->isAnonymous() && rendererForFirstLine Style->isRenderInline()
2648 && (!rendererForFirstLineStyle->node() || !rendererForFirstLineStyle->no de()->isFirstLetterPseudoElement())) {
2649
2648 RenderStyle* parentStyle = rendererForFirstLineStyle->parent()->firstLin eStyle(); 2650 RenderStyle* parentStyle = rendererForFirstLineStyle->parent()->firstLin eStyle();
2649 if (parentStyle != rendererForFirstLineStyle->parent()->style()) { 2651 if (parentStyle != rendererForFirstLineStyle->parent()->style()) {
2650 if (type == Cached) { 2652 if (type == Cached) {
2651 // A first-line style is in effect. Cache a first-line style for ourselves. 2653 // A first-line style is in effect. Cache a first-line style for ourselves.
2652 rendererForFirstLineStyle->style()->setHasPseudoStyle(FIRST_LINE _INHERITED); 2654 rendererForFirstLineStyle->style()->setHasPseudoStyle(FIRST_LINE _INHERITED);
2653 return rendererForFirstLineStyle->getCachedPseudoStyle(FIRST_LIN E_INHERITED, parentStyle); 2655 return rendererForFirstLineStyle->getCachedPseudoStyle(FIRST_LIN E_INHERITED, parentStyle);
2654 } 2656 }
2655 return rendererForFirstLineStyle->getUncachedPseudoStyle(PseudoStyle Request(FIRST_LINE_INHERITED), parentStyle, style); 2657 return rendererForFirstLineStyle->getUncachedPseudoStyle(PseudoStyle Request(FIRST_LINE_INHERITED), parentStyle, style);
2656 } 2658 }
2657 } 2659 }
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
3173 { 3175 {
3174 if (object1) { 3176 if (object1) {
3175 const blink::RenderObject* root = object1; 3177 const blink::RenderObject* root = object1;
3176 while (root->parent()) 3178 while (root->parent())
3177 root = root->parent(); 3179 root = root->parent();
3178 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3180 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3179 } 3181 }
3180 } 3182 }
3181 3183
3182 #endif 3184 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698