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

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 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after
1627 if (diff.needsPaintInvalidationLayer() && !hasLayer()) { 1627 if (diff.needsPaintInvalidationLayer() && !hasLayer()) {
1628 diff.clearNeedsPaintInvalidation(); 1628 diff.clearNeedsPaintInvalidation();
1629 diff.setNeedsPaintInvalidationObject(); 1629 diff.setNeedsPaintInvalidationObject();
1630 } 1630 }
1631 1631
1632 return diff; 1632 return diff;
1633 } 1633 }
1634 1634
1635 void RenderObject::setPseudoStyle(PassRefPtr<RenderStyle> pseudoStyle) 1635 void RenderObject::setPseudoStyle(PassRefPtr<RenderStyle> pseudoStyle)
1636 { 1636 {
1637 ASSERT(pseudoStyle->styleType() == BEFORE || pseudoStyle->styleType() == AFT ER); 1637 ASSERT(pseudoStyle->styleType() == BEFORE || pseudoStyle->styleType() == AFT ER || pseudoStyle->styleType() == FIRST_LETTER);
1638 1638
1639 // FIXME: We should consider just making all pseudo items use an inherited s tyle. 1639 // FIXME: We should consider just making all pseudo items use an inherited s tyle.
1640 1640
1641 // Images are special and must inherit the pseudoStyle so the width and heig ht of 1641 // Images are special and must inherit the pseudoStyle so the width and heig ht of
1642 // the pseudo element doesn't change the size of the image. In all other cas es we 1642 // the pseudo element doesn't change the size of the image. In all other cas es we
1643 // can just share the style. 1643 // can just share the style.
1644 // 1644 //
1645 // Quotes are also RenderInline, so we need to create an inherited style to avoid 1645 // Quotes are also RenderInline, so we need to create an inherited style to avoid
1646 // getting an inline with positioning or an invalid display. 1646 // getting an inline with positioning or an invalid display.
1647 // 1647 //
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after
2649 const RenderObject* rendererForFirstLineStyle = renderer; 2649 const RenderObject* rendererForFirstLineStyle = renderer;
2650 if (renderer->isBeforeOrAfterContent()) 2650 if (renderer->isBeforeOrAfterContent())
2651 rendererForFirstLineStyle = renderer->parent(); 2651 rendererForFirstLineStyle = renderer->parent();
2652 2652
2653 if (rendererForFirstLineStyle->isRenderBlockFlow() || rendererForFirstLineSt yle->isRenderButton()) { 2653 if (rendererForFirstLineStyle->isRenderBlockFlow() || rendererForFirstLineSt yle->isRenderButton()) {
2654 if (RenderBlock* firstLineBlock = rendererForFirstLineStyle->firstLineBl ock()) { 2654 if (RenderBlock* firstLineBlock = rendererForFirstLineStyle->firstLineBl ock()) {
2655 if (type == Cached) 2655 if (type == Cached)
2656 return firstLineBlock->getCachedPseudoStyle(FIRST_LINE, style); 2656 return firstLineBlock->getCachedPseudoStyle(FIRST_LINE, style);
2657 return firstLineBlock->getUncachedPseudoStyle(PseudoStyleRequest(FIR ST_LINE), style, firstLineBlock == renderer ? style : 0); 2657 return firstLineBlock->getUncachedPseudoStyle(PseudoStyleRequest(FIR ST_LINE), style, firstLineBlock == renderer ? style : 0);
2658 } 2658 }
2659 } else if (!rendererForFirstLineStyle->isAnonymous() && rendererForFirstLine Style->isRenderInline()) { 2659 } else if (!rendererForFirstLineStyle->isAnonymous() && rendererForFirstLine Style->isRenderInline()
2660 && (!rendererForFirstLineStyle->node() || !rendererForFirstLineStyle->no de()->isFirstLetterPseudoElement())) {
2661
2660 RenderStyle* parentStyle = rendererForFirstLineStyle->parent()->firstLin eStyle(); 2662 RenderStyle* parentStyle = rendererForFirstLineStyle->parent()->firstLin eStyle();
2661 if (parentStyle != rendererForFirstLineStyle->parent()->style()) { 2663 if (parentStyle != rendererForFirstLineStyle->parent()->style()) {
2662 if (type == Cached) { 2664 if (type == Cached) {
2663 // A first-line style is in effect. Cache a first-line style for ourselves. 2665 // A first-line style is in effect. Cache a first-line style for ourselves.
2664 rendererForFirstLineStyle->style()->setHasPseudoStyle(FIRST_LINE _INHERITED); 2666 rendererForFirstLineStyle->style()->setHasPseudoStyle(FIRST_LINE _INHERITED);
2665 return rendererForFirstLineStyle->getCachedPseudoStyle(FIRST_LIN E_INHERITED, parentStyle); 2667 return rendererForFirstLineStyle->getCachedPseudoStyle(FIRST_LIN E_INHERITED, parentStyle);
2666 } 2668 }
2667 return rendererForFirstLineStyle->getUncachedPseudoStyle(PseudoStyle Request(FIRST_LINE_INHERITED), parentStyle, style); 2669 return rendererForFirstLineStyle->getUncachedPseudoStyle(PseudoStyle Request(FIRST_LINE_INHERITED), parentStyle, style);
2668 } 2670 }
2669 } 2671 }
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
3184 { 3186 {
3185 if (object1) { 3187 if (object1) {
3186 const blink::RenderObject* root = object1; 3188 const blink::RenderObject* root = object1;
3187 while (root->parent()) 3189 while (root->parent())
3188 root = root->parent(); 3190 root = root->parent();
3189 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3191 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3190 } 3192 }
3191 } 3193 }
3192 3194
3193 #endif 3195 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698