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

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

Issue 672953002: Convert first letter into a pseudo element. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « Source/core/rendering/RenderObject.h ('k') | Source/core/rendering/RenderObjectChildList.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after
1589 if (diff.needsPaintInvalidationLayer() && !hasLayer()) { 1589 if (diff.needsPaintInvalidationLayer() && !hasLayer()) {
1590 diff.clearNeedsPaintInvalidation(); 1590 diff.clearNeedsPaintInvalidation();
1591 diff.setNeedsPaintInvalidationObject(); 1591 diff.setNeedsPaintInvalidationObject();
1592 } 1592 }
1593 1593
1594 return diff; 1594 return diff;
1595 } 1595 }
1596 1596
1597 void RenderObject::setPseudoStyle(PassRefPtr<RenderStyle> pseudoStyle) 1597 void RenderObject::setPseudoStyle(PassRefPtr<RenderStyle> pseudoStyle)
1598 { 1598 {
1599 ASSERT(pseudoStyle->styleType() == BEFORE || pseudoStyle->styleType() == AFT ER); 1599 ASSERT(pseudoStyle->styleType() == BEFORE || pseudoStyle->styleType() == AFT ER || pseudoStyle->styleType() == FIRST_LETTER);
1600 1600
1601 // FIXME: We should consider just making all pseudo items use an inherited s tyle. 1601 // FIXME: We should consider just making all pseudo items use an inherited s tyle.
1602 1602
1603 // Images are special and must inherit the pseudoStyle so the width and heig ht of 1603 // Images are special and must inherit the pseudoStyle so the width and heig ht of
1604 // the pseudo element doesn't change the size of the image. In all other cas es we 1604 // the pseudo element doesn't change the size of the image. In all other cas es we
1605 // can just share the style. 1605 // can just share the style.
1606 // 1606 //
1607 // Quotes are also RenderInline, so we need to create an inherited style to avoid 1607 // Quotes are also RenderInline, so we need to create an inherited style to avoid
1608 // getting an inline with positioning or an invalid display. 1608 // getting an inline with positioning or an invalid display.
1609 // 1609 //
(...skipping 1004 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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
3147 { 3148 {
3148 if (object1) { 3149 if (object1) {
3149 const blink::RenderObject* root = object1; 3150 const blink::RenderObject* root = object1;
3150 while (root->parent()) 3151 while (root->parent())
3151 root = root->parent(); 3152 root = root->parent();
3152 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3153 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3153 } 3154 }
3154 } 3155 }
3155 3156
3156 #endif 3157 #endif
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderObject.h ('k') | Source/core/rendering/RenderObjectChildList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698