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

Side by Side Diff: Source/core/css/resolver/StyleResolver.cpp

Issue 181783005: Have Element::ensureMutableInlineStyle() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 9 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 723 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 { 734 {
735 ASSERT(document().frame()); 735 ASSERT(document().frame());
736 ASSERT(documentSettings()); 736 ASSERT(documentSettings());
737 ASSERT(!hasPendingAuthorStyleSheets()); 737 ASSERT(!hasPendingAuthorStyleSheets());
738 738
739 if (element == document().documentElement()) 739 if (element == document().documentElement())
740 resetDirectionAndWritingModeOnDocument(document()); 740 resetDirectionAndWritingModeOnDocument(document());
741 StyleResolverState state(document(), element, parentStyle); 741 StyleResolverState state(document(), element, parentStyle);
742 742
743 MatchResult result; 743 MatchResult result;
744 if (keyframe->properties()) 744 result.addMatchedProperties(&keyframe->properties());
745 result.addMatchedProperties(keyframe->properties());
746 745
747 ASSERT(!state.style()); 746 ASSERT(!state.style());
748 747
749 // Create the style 748 // Create the style
750 state.setStyle(RenderStyle::clone(&elementStyle)); 749 state.setStyle(RenderStyle::clone(&elementStyle));
751 state.setLineHeightValue(0); 750 state.setLineHeightValue(0);
752 751
753 // Make sure that the CSSAnimationData for the animation to which this 752 // Make sure that the CSSAnimationData for the animation to which this
754 // keyframe belongs is first in the list. This makes sure that if the 753 // keyframe belongs is first in the list. This makes sure that if the
755 // animation-timing-function property is set for this keyframe, it will be 754 // animation-timing-function property is set for this keyframe, it will be
756 // applied to the correct CSSAnimationData object. Note that objects other 755 // applied to the correct CSSAnimationData object. Note that objects other
757 // than the first in the list are ignored when reading the timing function 756 // than the first in the list are ignored when reading the timing function
758 // value. See KeyframeValue::timingFunction(). 757 // value. See KeyframeValue::timingFunction().
759 CSSAnimationDataList* animations = state.style()->accessAnimations(); 758 CSSAnimationDataList* animations = state.style()->accessAnimations();
760 ASSERT(animations && !animations->isEmpty()); 759 ASSERT(animations && !animations->isEmpty());
761 while (animations->animation(0)->name() != animationName) 760 while (animations->animation(0)->name() != animationName)
762 animations->remove(0); 761 animations->remove(0);
763 ASSERT(!animations->isEmpty() && animations->animation(0)->name() == animati onName); 762 ASSERT(!animations->isEmpty() && animations->animation(0)->name() == animati onName);
764 763
765 state.fontBuilder().initForStyleResolve(state.document(), state.style(), sta te.useSVGZoomRules()); 764 state.fontBuilder().initForStyleResolve(state.document(), state.style(), sta te.useSVGZoomRules());
766 765
767 // We don't need to bother with !important. Since there is only ever one 766 // We don't need to bother with !important. Since there is only ever one
768 // decl, there's nothing to override. So just add the first properties. 767 // decl, there's nothing to override. So just add the first properties.
769 bool inheritedOnly = false; 768 bool inheritedOnly = false;
770 if (keyframe->properties()) { 769 applyMatchedProperties<AnimationProperties>(state, result, false, 0, result. matchedProperties.size() - 1, inheritedOnly);
771 applyMatchedProperties<AnimationProperties>(state, result, false, 0, res ult.matchedProperties.size() - 1, inheritedOnly); 770 applyMatchedProperties<HighPriorityProperties>(state, result, false, 0, resu lt.matchedProperties.size() - 1, inheritedOnly);
772 applyMatchedProperties<HighPriorityProperties>(state, result, false, 0, result.matchedProperties.size() - 1, inheritedOnly);
773 }
774 771
775 // If our font got dirtied, go ahead and update it now. 772 // If our font got dirtied, go ahead and update it now.
776 updateFont(state); 773 updateFont(state);
777 774
778 // Line-height is set when we are sure we decided on the font-size 775 // Line-height is set when we are sure we decided on the font-size
779 if (state.lineHeightValue()) 776 if (state.lineHeightValue())
780 StyleBuilder::applyProperty(CSSPropertyLineHeight, state, state.lineHeig htValue()); 777 StyleBuilder::applyProperty(CSSPropertyLineHeight, state, state.lineHeig htValue());
781 778
782 // Now do rest of the properties. 779 // Now do rest of the properties.
783 if (keyframe->properties()) 780 applyMatchedProperties<LowPriorityProperties>(state, result, false, 0, resul t.matchedProperties.size() - 1, inheritedOnly);
784 applyMatchedProperties<LowPriorityProperties>(state, result, false, 0, r esult.matchedProperties.size() - 1, inheritedOnly);
785 781
786 // If our font got dirtied by one of the non-essential font props, 782 // If our font got dirtied by one of the non-essential font props,
787 // go ahead and update it a second time. 783 // go ahead and update it a second time.
788 updateFont(state); 784 updateFont(state);
789 785
790 // Start loading resources referenced by this style. 786 // Start loading resources referenced by this style.
791 m_styleResourceLoader.loadPendingResources(state.style(), state.elementStyle Resources()); 787 m_styleResourceLoader.loadPendingResources(state.style(), state.elementStyle Resources());
792 document().styleEngine()->fontSelector()->loadPendingFonts(); 788 document().styleEngine()->fontSelector()->loadPendingFonts();
793 789
794 didAccess(); 790 didAccess();
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
1412 bool StyleResolver::mediaQueryAffectedByViewportChange() const 1408 bool StyleResolver::mediaQueryAffectedByViewportChange() const
1413 { 1409 {
1414 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) { 1410 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) {
1415 if (m_medium->eval(&m_viewportDependentMediaQueryResults[i]->m_expressio n) != m_viewportDependentMediaQueryResults[i]->m_result) 1411 if (m_medium->eval(&m_viewportDependentMediaQueryResults[i]->m_expressio n) != m_viewportDependentMediaQueryResults[i]->m_result)
1416 return true; 1412 return true;
1417 } 1413 }
1418 return false; 1414 return false;
1419 } 1415 }
1420 1416
1421 } // namespace WebCore 1417 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/StyleSheetContents.cpp ('k') | Source/core/css/resolver/ViewportStyleResolver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698