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

Side by Side Diff: Source/core/css/SelectorChecker.cpp

Issue 23717008: Remove useless null checks from Node::document() call sites (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 if (!matchesCustomPseudoElement(context.element, context.selector)) 146 if (!matchesCustomPseudoElement(context.element, context.selector))
147 return SelectorFailsLocally; 147 return SelectorFailsLocally;
148 } else if (context.selector->isContentPseudoElement()) { 148 } else if (context.selector->isContentPseudoElement()) {
149 if (!context.element->isInShadowTree() || !context.element->isInsert ionPoint()) 149 if (!context.element->isInShadowTree() || !context.element->isInsert ionPoint())
150 return SelectorFailsLocally; 150 return SelectorFailsLocally;
151 } else { 151 } else {
152 if ((!context.elementStyle && m_mode == ResolvingStyle) || m_mode == QueryingRules) 152 if ((!context.elementStyle && m_mode == ResolvingStyle) || m_mode == QueryingRules)
153 return SelectorFailsLocally; 153 return SelectorFailsLocally;
154 154
155 PseudoId pseudoId = CSSSelector::pseudoId(context.selector->pseudoTy pe()); 155 PseudoId pseudoId = CSSSelector::pseudoId(context.selector->pseudoTy pe());
156 if (pseudoId == FIRST_LETTER) { 156 if (pseudoId == FIRST_LETTER)
157 if (Document* document = context.element->document()) 157 context.element->document()->styleSheetCollections()->setUsesFir stLetterRules(true);
158 document->styleSheetCollections()->setUsesFirstLetterRules(t rue);
159 }
160 if (pseudoId != NOPSEUDO && m_mode != SharingRules) 158 if (pseudoId != NOPSEUDO && m_mode != SharingRules)
161 dynamicPseudo = pseudoId; 159 dynamicPseudo = pseudoId;
162 } 160 }
163 } 161 }
164 162
165 // The rest of the selectors has to match 163 // The rest of the selectors has to match
166 CSSSelector::Relation relation = context.selector->relation(); 164 CSSSelector::Relation relation = context.selector->relation();
167 165
168 // Prepare next selector 166 // Prepare next selector
169 const CSSSelector* historySelector = context.selector->tagHistory(); 167 const CSSSelector* historySelector = context.selector->tagHistory();
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 } 666 }
669 if (element->active() || InspectorInstrumentation::forcePseudoSt ate(element, CSSSelector::PseudoActive)) 667 if (element->active() || InspectorInstrumentation::forcePseudoSt ate(element, CSSSelector::PseudoActive))
670 return true; 668 return true;
671 } 669 }
672 break; 670 break;
673 case CSSSelector::PseudoEnabled: 671 case CSSSelector::PseudoEnabled:
674 if (element && (element->isFormControlElement() || element->hasTagNa me(optionTag) || isHTMLOptGroupElement(element))) 672 if (element && (element->isFormControlElement() || element->hasTagNa me(optionTag) || isHTMLOptGroupElement(element)))
675 return !element->isDisabledFormControl(); 673 return !element->isDisabledFormControl();
676 break; 674 break;
677 case CSSSelector::PseudoFullPageMedia: 675 case CSSSelector::PseudoFullPageMedia:
678 return element && element->document() && element->document()->isMedi aDocument(); 676 return element && element->document()->isMediaDocument();
679 break; 677 break;
680 case CSSSelector::PseudoDefault: 678 case CSSSelector::PseudoDefault:
681 return element && element->isDefaultButtonForForm(); 679 return element && element->isDefaultButtonForForm();
682 case CSSSelector::PseudoDisabled: 680 case CSSSelector::PseudoDisabled:
683 if (element && (element->isFormControlElement() || element->hasTagNa me(optionTag) || isHTMLOptGroupElement(element))) 681 if (element && (element->isFormControlElement() || element->hasTagNa me(optionTag) || isHTMLOptGroupElement(element)))
684 return element->isDisabledFormControl(); 682 return element->isDisabledFormControl();
685 break; 683 break;
686 case CSSSelector::PseudoReadOnly: 684 case CSSSelector::PseudoReadOnly:
687 return element && element->matchesReadOnlyPseudoClass(); 685 return element && element->matchesReadOnlyPseudoClass();
688 case CSSSelector::PseudoReadWrite: 686 case CSSSelector::PseudoReadWrite:
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 return element->focused() && isFrameFocused(element); 992 return element->focused() && isFrameFocused(element);
995 } 993 }
996 994
997 template 995 template
998 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, Ps eudoId&, const DOMSiblingTraversalStrategy&) const; 996 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, Ps eudoId&, const DOMSiblingTraversalStrategy&) const;
999 997
1000 template 998 template
1001 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, Ps eudoId&, const ShadowDOMSiblingTraversalStrategy&) const; 999 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, Ps eudoId&, const ShadowDOMSiblingTraversalStrategy&) const;
1002 1000
1003 } 1001 }
OLDNEW
« no previous file with comments | « Source/core/accessibility/AccessibilityObject.cpp ('k') | Source/core/css/resolver/ElementResolveContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698