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

Side by Side Diff: Source/WebCore/css/CSSParser.cpp

Issue 11179002: Merge 130511 - Web Inspector: [Styles] Unable to edit properties in broken stylesheets (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1229/
Patch Set: Created 8 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
« no previous file with comments | « Source/WebCore/css/CSSParser.h ('k') | no next file » | 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) 2003 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
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 9609 matching lines...) Expand 10 before | Expand all | Expand 10 after
9620 else 9620 else
9621 m_currentRuleDataStack->last()->childRules.append(rule); 9621 m_currentRuleDataStack->last()->childRules.append(rule);
9622 } 9622 }
9623 9623
9624 PassRefPtr<CSSRuleSourceData> CSSParser::popRuleData() 9624 PassRefPtr<CSSRuleSourceData> CSSParser::popRuleData()
9625 { 9625 {
9626 if (!m_ruleSourceDataResult) 9626 if (!m_ruleSourceDataResult)
9627 return 0; 9627 return 0;
9628 9628
9629 ASSERT(!m_currentRuleDataStack->isEmpty()); 9629 ASSERT(!m_currentRuleDataStack->isEmpty());
9630 m_currentRuleData.clear();
9630 RefPtr<CSSRuleSourceData> data = m_currentRuleDataStack->last(); 9631 RefPtr<CSSRuleSourceData> data = m_currentRuleDataStack->last();
9631 m_currentRuleDataStack->removeLast(); 9632 m_currentRuleDataStack->removeLast();
9632 return data.release(); 9633 return data.release();
9633 } 9634 }
9634 9635
9635 StyleRuleKeyframes* CSSParser::createKeyframesRule(const String& name, PassOwnPt r<Vector<RefPtr<StyleKeyframe> > > popKeyframes) 9636 StyleRuleKeyframes* CSSParser::createKeyframesRule(const String& name, PassOwnPt r<Vector<RefPtr<StyleKeyframe> > > popKeyframes)
9636 { 9637 {
9637 OwnPtr<Vector<RefPtr<StyleKeyframe> > > keyframes = popKeyframes; 9638 OwnPtr<Vector<RefPtr<StyleKeyframe> > > keyframes = popKeyframes;
9638 m_allowImportRules = m_allowNamespaceDeclarations = false; 9639 m_allowImportRules = m_allowNamespaceDeclarations = false;
9639 RefPtr<StyleRuleKeyframes> rule = StyleRuleKeyframes::create(); 9640 RefPtr<StyleRuleKeyframes> rule = StyleRuleKeyframes::create();
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
9913 // Need to exclude the trailing ';' from the property value. 9914 // Need to exclude the trailing ';' from the property value.
9914 currentData->value = String(characters + valueStartInStyleSheet, pro pertyEndInStyleSheet - valueStartInStyleSheet + (characters[propertyEndInStyleSh eet] == ';' ? 0 : 1)); 9915 currentData->value = String(characters + valueStartInStyleSheet, pro pertyEndInStyleSheet - valueStartInStyleSheet + (characters[propertyEndInStyleSh eet] == ';' ? 0 : 1));
9915 } 9916 }
9916 } 9917 }
9917 } 9918 }
9918 9919
9919 void CSSParser::markRuleHeaderStart(CSSRuleSourceData::Type ruleType) 9920 void CSSParser::markRuleHeaderStart(CSSRuleSourceData::Type ruleType)
9920 { 9921 {
9921 if (!isExtractingSourceData()) 9922 if (!isExtractingSourceData())
9922 return; 9923 return;
9924
9925 // Pop off data for a previous invalid rule.
9926 if (m_currentRuleData)
9927 m_currentRuleDataStack->removeLast();
9928
9923 RefPtr<CSSRuleSourceData> data = CSSRuleSourceData::create(ruleType); 9929 RefPtr<CSSRuleSourceData> data = CSSRuleSourceData::create(ruleType);
9924 data->ruleHeaderRange.start = m_tokenStart - m_dataStart.get(); 9930 data->ruleHeaderRange.start = m_tokenStart - m_dataStart.get();
9931 m_currentRuleData = data;
9925 m_currentRuleDataStack->append(data.release()); 9932 m_currentRuleDataStack->append(data.release());
9926 } 9933 }
9927 9934
9928 void CSSParser::markRuleHeaderEnd() 9935 void CSSParser::markRuleHeaderEnd()
9929 { 9936 {
9930 if (!isExtractingSourceData()) 9937 if (!isExtractingSourceData())
9931 return; 9938 return;
9932 ASSERT(!m_currentRuleDataStack->isEmpty()); 9939 ASSERT(!m_currentRuleDataStack->isEmpty());
9933 UChar* listEnd = m_tokenStart; 9940 UChar* listEnd = m_tokenStart;
9934 while (listEnd > m_dataStart.get() + 1) { 9941 while (listEnd > m_dataStart.get() + 1) {
9935 if (isHTMLSpace(*(listEnd - 1))) 9942 if (isHTMLSpace(*(listEnd - 1)))
9936 --listEnd; 9943 --listEnd;
9937 else 9944 else
9938 break; 9945 break;
9939 } 9946 }
9940 m_currentRuleDataStack->last()->ruleHeaderRange.end = listEnd - m_dataStart. get(); 9947 m_currentRuleDataStack->last()->ruleHeaderRange.end = listEnd - m_dataStart. get();
9941 } 9948 }
9942 9949
9943 void CSSParser::markRuleBodyStart() 9950 void CSSParser::markRuleBodyStart()
9944 { 9951 {
9945 if (!isExtractingSourceData()) 9952 if (!isExtractingSourceData())
9946 return; 9953 return;
9954 m_currentRuleData.clear();
9947 unsigned offset = m_tokenStart - m_dataStart.get(); 9955 unsigned offset = m_tokenStart - m_dataStart.get();
9948 if (*m_tokenStart == '{') 9956 if (*m_tokenStart == '{')
9949 ++offset; // Skip the rule body opening brace. 9957 ++offset; // Skip the rule body opening brace.
9950 ASSERT(!m_currentRuleDataStack->isEmpty()); 9958 ASSERT(!m_currentRuleDataStack->isEmpty());
9951 m_currentRuleDataStack->last()->ruleBodyRange.start = offset; 9959 m_currentRuleDataStack->last()->ruleBodyRange.start = offset;
9952 } 9960 }
9953 9961
9954 void CSSParser::markRuleBodyEnd() 9962 void CSSParser::markRuleBodyEnd()
9955 { 9963 {
9956 // Precondition: (!isExtractingSourceData()) 9964 // Precondition: (!isExtractingSourceData())
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
10212 { 10220 {
10213 // The tokenizer checks for the construct of an+b. 10221 // The tokenizer checks for the construct of an+b.
10214 // However, since the {ident} rule precedes the {nth} rule, some of those 10222 // However, since the {ident} rule precedes the {nth} rule, some of those
10215 // tokens are identified as string literal. Furthermore we need to accept 10223 // tokens are identified as string literal. Furthermore we need to accept
10216 // "odd" and "even" which does not match to an+b. 10224 // "odd" and "even" which does not match to an+b.
10217 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") 10225 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even")
10218 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); 10226 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n");
10219 } 10227 }
10220 10228
10221 } 10229 }
OLDNEW
« no previous file with comments | « Source/WebCore/css/CSSParser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698