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

Side by Side Diff: Source/core/css/resolver/StyleResolver.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) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 #include "core/css/resolver/AnimatedStyleBuilder.h" 61 #include "core/css/resolver/AnimatedStyleBuilder.h"
62 #include "core/css/resolver/MatchResult.h" 62 #include "core/css/resolver/MatchResult.h"
63 #include "core/css/resolver/MediaQueryResult.h" 63 #include "core/css/resolver/MediaQueryResult.h"
64 #include "core/css/resolver/SharedStyleFinder.h" 64 #include "core/css/resolver/SharedStyleFinder.h"
65 #include "core/css/resolver/StyleAdjuster.h" 65 #include "core/css/resolver/StyleAdjuster.h"
66 #include "core/css/resolver/StyleResolverParentScope.h" 66 #include "core/css/resolver/StyleResolverParentScope.h"
67 #include "core/css/resolver/StyleResolverState.h" 67 #include "core/css/resolver/StyleResolverState.h"
68 #include "core/css/resolver/StyleResolverStats.h" 68 #include "core/css/resolver/StyleResolverStats.h"
69 #include "core/css/resolver/ViewportStyleResolver.h" 69 #include "core/css/resolver/ViewportStyleResolver.h"
70 #include "core/dom/CSSSelectorWatch.h" 70 #include "core/dom/CSSSelectorWatch.h"
71 #include "core/dom/FirstLetterPseudoElement.h"
71 #include "core/dom/NodeRenderStyle.h" 72 #include "core/dom/NodeRenderStyle.h"
72 #include "core/dom/StyleEngine.h" 73 #include "core/dom/StyleEngine.h"
73 #include "core/dom/Text.h" 74 #include "core/dom/Text.h"
74 #include "core/dom/shadow/ElementShadow.h" 75 #include "core/dom/shadow/ElementShadow.h"
75 #include "core/dom/shadow/ShadowRoot.h" 76 #include "core/dom/shadow/ShadowRoot.h"
76 #include "core/frame/FrameView.h" 77 #include "core/frame/FrameView.h"
77 #include "core/frame/LocalFrame.h" 78 #include "core/frame/LocalFrame.h"
78 #include "core/html/HTMLIFrameElement.h" 79 #include "core/html/HTMLIFrameElement.h"
79 #include "core/inspector/InspectorInstrumentation.h" 80 #include "core/inspector/InspectorInstrumentation.h"
80 #include "core/rendering/RenderView.h" 81 #include "core/rendering/RenderView.h"
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 StyleBuilder::applyProperty(property, state, &value); 713 StyleBuilder::applyProperty(property, state, &value);
713 return CSSAnimatableValueFactory::create(property, *state.style()); 714 return CSSAnimatableValueFactory::create(property, *state.style());
714 } 715 }
715 716
716 PassRefPtrWillBeRawPtr<PseudoElement> StyleResolver::createPseudoElementIfNeeded (Element& parent, PseudoId pseudoId) 717 PassRefPtrWillBeRawPtr<PseudoElement> StyleResolver::createPseudoElementIfNeeded (Element& parent, PseudoId pseudoId)
717 { 718 {
718 RenderObject* parentRenderer = parent.renderer(); 719 RenderObject* parentRenderer = parent.renderer();
719 if (!parentRenderer) 720 if (!parentRenderer)
720 return nullptr; 721 return nullptr;
721 722
722 if (pseudoId < FIRST_INTERNAL_PSEUDOID && !parentRenderer->style()->hasPseud oStyle(pseudoId)) 723 // The first letter pseudo element has to look up the tree and see if any
724 // of the ancestors are first letter.
725 if (pseudoId < FIRST_INTERNAL_PSEUDOID && pseudoId != FIRST_LETTER && !paren tRenderer->style()->hasPseudoStyle(pseudoId))
723 return nullptr; 726 return nullptr;
724 727
725 if (pseudoId == BACKDROP && !parent.isInTopLayer()) 728 if (pseudoId == BACKDROP && !parent.isInTopLayer())
726 return nullptr; 729 return nullptr;
727 730
731 if (pseudoId == FIRST_LETTER && (parent.isSVGElement() || !FirstLetterPseudo Element::firstLetterTextRenderer(parent)))
732 return nullptr;
733
728 if (!parentRenderer->canHaveGeneratedChildren()) 734 if (!parentRenderer->canHaveGeneratedChildren())
729 return nullptr; 735 return nullptr;
730 736
731 RenderStyle* parentStyle = parentRenderer->style(); 737 RenderStyle* parentStyle = parentRenderer->style();
732 if (RenderStyle* cachedStyle = parentStyle->getCachedPseudoStyle(pseudoId)) { 738 if (RenderStyle* cachedStyle = parentStyle->getCachedPseudoStyle(pseudoId)) {
733 if (!pseudoElementRendererIsNeeded(cachedStyle)) 739 if (!pseudoElementRendererIsNeeded(cachedStyle))
734 return nullptr; 740 return nullptr;
735 return PseudoElement::create(&parent, pseudoId); 741 return PseudoElement::create(&parent, pseudoId);
736 } 742 }
737 743
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after
1582 visitor->trace(m_uncommonAttributeRuleSet); 1588 visitor->trace(m_uncommonAttributeRuleSet);
1583 visitor->trace(m_watchedSelectorsRules); 1589 visitor->trace(m_watchedSelectorsRules);
1584 visitor->trace(m_treeBoundaryCrossingRules); 1590 visitor->trace(m_treeBoundaryCrossingRules);
1585 visitor->trace(m_styleSharingLists); 1591 visitor->trace(m_styleSharingLists);
1586 visitor->trace(m_pendingStyleSheets); 1592 visitor->trace(m_pendingStyleSheets);
1587 visitor->trace(m_document); 1593 visitor->trace(m_document);
1588 #endif 1594 #endif
1589 } 1595 }
1590 1596
1591 } // namespace blink 1597 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/dom/Element.cpp » ('j') | Source/core/dom/Element.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698