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

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 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 if (diff.needsPaintInvalidationLayer() && !hasLayer()) { 1592 if (diff.needsPaintInvalidationLayer() && !hasLayer()) {
1593 diff.clearNeedsPaintInvalidation(); 1593 diff.clearNeedsPaintInvalidation();
1594 diff.setNeedsPaintInvalidationObject(); 1594 diff.setNeedsPaintInvalidationObject();
1595 } 1595 }
1596 1596
1597 return diff; 1597 return diff;
1598 } 1598 }
1599 1599
1600 void RenderObject::setPseudoStyle(PassRefPtr<RenderStyle> pseudoStyle) 1600 void RenderObject::setPseudoStyle(PassRefPtr<RenderStyle> pseudoStyle)
1601 { 1601 {
1602 ASSERT(pseudoStyle->styleType() == BEFORE || pseudoStyle->styleType() == AFT ER); 1602 ASSERT(pseudoStyle->styleType() == BEFORE || pseudoStyle->styleType() == AFT ER || pseudoStyle->styleType() == FIRST_LETTER);
1603 1603
1604 // FIXME: We should consider just making all pseudo items use an inherited s tyle. 1604 // FIXME: We should consider just making all pseudo items use an inherited s tyle.
1605 1605
1606 // Images are special and must inherit the pseudoStyle so the width and heig ht of 1606 // Images are special and must inherit the pseudoStyle so the width and heig ht of
1607 // the pseudo element doesn't change the size of the image. In all other cas es we 1607 // the pseudo element doesn't change the size of the image. In all other cas es we
1608 // can just share the style. 1608 // can just share the style.
1609 // 1609 //
1610 // Quotes are also RenderInline, so we need to create an inherited style to avoid 1610 // Quotes are also RenderInline, so we need to create an inherited style to avoid
1611 // getting an inline with positioning or an invalid display. 1611 // getting an inline with positioning or an invalid display.
1612 // 1612 //
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after
2614 const RenderObject* rendererForFirstLineStyle = renderer; 2614 const RenderObject* rendererForFirstLineStyle = renderer;
2615 if (renderer->isBeforeOrAfterContent()) 2615 if (renderer->isBeforeOrAfterContent())
2616 rendererForFirstLineStyle = renderer->parent(); 2616 rendererForFirstLineStyle = renderer->parent();
2617 2617
2618 if (rendererForFirstLineStyle->isRenderBlockFlow() || rendererForFirstLineSt yle->isRenderButton()) { 2618 if (rendererForFirstLineStyle->isRenderBlockFlow() || rendererForFirstLineSt yle->isRenderButton()) {
2619 if (RenderBlock* firstLineBlock = rendererForFirstLineStyle->firstLineBl ock()) { 2619 if (RenderBlock* firstLineBlock = rendererForFirstLineStyle->firstLineBl ock()) {
2620 if (type == Cached) 2620 if (type == Cached)
2621 return firstLineBlock->getCachedPseudoStyle(FIRST_LINE, style); 2621 return firstLineBlock->getCachedPseudoStyle(FIRST_LINE, style);
2622 return firstLineBlock->getUncachedPseudoStyle(PseudoStyleRequest(FIR ST_LINE), style, firstLineBlock == renderer ? style : 0); 2622 return firstLineBlock->getUncachedPseudoStyle(PseudoStyleRequest(FIR ST_LINE), style, firstLineBlock == renderer ? style : 0);
2623 } 2623 }
2624 } else if (!rendererForFirstLineStyle->isAnonymous() && rendererForFirstLine Style->isRenderInline()) { 2624 } else if (!rendererForFirstLineStyle->isAnonymous() && rendererForFirstLine Style->isRenderInline()
2625 && !rendererForFirstLineStyle->node()->isFirstLetterPseudoElement()) {
2625 RenderStyle* parentStyle = rendererForFirstLineStyle->parent()->firstLin eStyle(); 2626 RenderStyle* parentStyle = rendererForFirstLineStyle->parent()->firstLin eStyle();
2626 if (parentStyle != rendererForFirstLineStyle->parent()->style()) { 2627 if (parentStyle != rendererForFirstLineStyle->parent()->style()) {
2627 if (type == Cached) { 2628 if (type == Cached) {
2628 // A first-line style is in effect. Cache a first-line style for ourselves. 2629 // A first-line style is in effect. Cache a first-line style for ourselves.
2629 rendererForFirstLineStyle->style()->setHasPseudoStyle(FIRST_LINE _INHERITED); 2630 rendererForFirstLineStyle->style()->setHasPseudoStyle(FIRST_LINE _INHERITED);
2630 return rendererForFirstLineStyle->getCachedPseudoStyle(FIRST_LIN E_INHERITED, parentStyle); 2631 return rendererForFirstLineStyle->getCachedPseudoStyle(FIRST_LIN E_INHERITED, parentStyle);
2631 } 2632 }
2632 return rendererForFirstLineStyle->getUncachedPseudoStyle(PseudoStyle Request(FIRST_LINE_INHERITED), parentStyle, style); 2633 return rendererForFirstLineStyle->getUncachedPseudoStyle(PseudoStyle Request(FIRST_LINE_INHERITED), parentStyle, style);
2633 } 2634 }
2634 } 2635 }
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
3139 { 3140 {
3140 if (object1) { 3141 if (object1) {
3141 const blink::RenderObject* root = object1; 3142 const blink::RenderObject* root = object1;
3142 while (root->parent()) 3143 while (root->parent())
3143 root = root->parent(); 3144 root = root->parent();
3144 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3145 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3145 } 3146 }
3146 } 3147 }
3147 3148
3148 #endif 3149 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698