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

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

Issue 15072003: Move StyleResolver and related classes to core/css/resolver (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 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
« no previous file with comments | « Source/core/css/resolver/StyleResolver.h ('k') | Source/core/css/resolver/StyleResolverState.h » ('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) 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.
11 * Copyright (C) 2012 Google Inc. All rights reserved. 11 * Copyright (C) 2012 Google Inc. All rights reserved.
12 * 12 *
13 * This library is free software; you can redistribute it and/or 13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Library General Public 14 * modify it under the terms of the GNU Library General Public
15 * License as published by the Free Software Foundation; either 15 * License as published by the Free Software Foundation; either
16 * version 2 of the License, or (at your option) any later version. 16 * version 2 of the License, or (at your option) any later version.
17 * 17 *
18 * This library is distributed in the hope that it will be useful, 18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Library General Public License for more details. 21 * Library General Public License for more details.
22 * 22 *
23 * You should have received a copy of the GNU Library General Public License 23 * You should have received a copy of the GNU Library General Public License
24 * along with this library; see the file COPYING.LIB. If not, write to 24 * along with this library; see the file COPYING.LIB. If not, write to
25 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 25 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
26 * Boston, MA 02110-1301, USA. 26 * Boston, MA 02110-1301, USA.
27 */ 27 */
28 28
29 #include "config.h" 29 #include "config.h"
30 #include "core/css/StyleResolver.h" 30 #include "core/css/resolver/StyleResolver.h"
31 31
32 #include "CSSPropertyNames.h" 32 #include "CSSPropertyNames.h"
33 #include "HTMLNames.h" 33 #include "HTMLNames.h"
34 #include "MathMLNames.h" 34 #include "MathMLNames.h"
35 #include "RuntimeEnabledFeatures.h" 35 #include "RuntimeEnabledFeatures.h"
36 #include "UserAgentStyleSheets.h" 36 #include "UserAgentStyleSheets.h"
37 #include "WebKitFontFamilyNames.h" 37 #include "WebKitFontFamilyNames.h"
38 #include "XMLNames.h" 38 #include "XMLNames.h"
39 #include "core/animation/Animation.h" 39 #include "core/animation/Animation.h"
40 #include "core/css/CSSBorderImage.h" 40 #include "core/css/CSSBorderImage.h"
(...skipping 10 matching lines...) Expand all
51 #include "core/css/CSSSelector.h" 51 #include "core/css/CSSSelector.h"
52 #include "core/css/CSSSelectorList.h" 52 #include "core/css/CSSSelectorList.h"
53 #include "core/css/CSSStyleRule.h" 53 #include "core/css/CSSStyleRule.h"
54 #include "core/css/CSSSupportsRule.h" 54 #include "core/css/CSSSupportsRule.h"
55 #include "core/css/CSSTimingFunctionValue.h" 55 #include "core/css/CSSTimingFunctionValue.h"
56 #include "core/css/CSSValueList.h" 56 #include "core/css/CSSValueList.h"
57 #include "core/css/CSSVariableValue.h" 57 #include "core/css/CSSVariableValue.h"
58 #include "core/css/Counter.h" 58 #include "core/css/Counter.h"
59 #include "core/css/DeprecatedStyleBuilder.h" 59 #include "core/css/DeprecatedStyleBuilder.h"
60 #include "core/css/ElementRuleCollector.h" 60 #include "core/css/ElementRuleCollector.h"
61 #include "core/css/FilterOperationResolver.h"
62 #include "core/css/FontFeatureValue.h" 61 #include "core/css/FontFeatureValue.h"
63 #include "core/css/FontValue.h" 62 #include "core/css/FontValue.h"
64 #include "core/css/MediaList.h" 63 #include "core/css/MediaList.h"
65 #include "core/css/MediaQueryEvaluator.h" 64 #include "core/css/MediaQueryEvaluator.h"
66 #include "core/css/PageRuleCollector.h" 65 #include "core/css/PageRuleCollector.h"
67 #include "core/css/Pair.h" 66 #include "core/css/Pair.h"
68 #include "core/css/Rect.h" 67 #include "core/css/Rect.h"
69 #include "core/css/RuleSet.h" 68 #include "core/css/RuleSet.h"
70 #include "core/css/SelectorCheckerFastPath.h" 69 #include "core/css/SelectorCheckerFastPath.h"
71 #include "core/css/ShadowValue.h" 70 #include "core/css/ShadowValue.h"
72 #include "core/css/StylePropertySet.h" 71 #include "core/css/StylePropertySet.h"
73 #include "core/css/StylePropertyShorthand.h" 72 #include "core/css/StylePropertyShorthand.h"
74 #include "core/css/StyleRule.h" 73 #include "core/css/StyleRule.h"
75 #include "core/css/StyleRuleImport.h" 74 #include "core/css/StyleRuleImport.h"
76 #include "core/css/StyleSheetContents.h" 75 #include "core/css/StyleSheetContents.h"
77 #include "core/css/StyleSheetList.h" 76 #include "core/css/StyleSheetList.h"
78 #include "core/css/TransformBuilder.h"
79 #include "core/css/ViewportStyleResolver.h"
80 #include "core/css/WebKitCSSKeyframeRule.h" 77 #include "core/css/WebKitCSSKeyframeRule.h"
81 #include "core/css/WebKitCSSKeyframesRule.h" 78 #include "core/css/WebKitCSSKeyframesRule.h"
82 #include "core/css/WebKitCSSRegionRule.h" 79 #include "core/css/WebKitCSSRegionRule.h"
80 #include "core/css/resolver/FilterOperationResolver.h"
81 #include "core/css/resolver/TransformBuilder.h"
82 #include "core/css/resolver/ViewportStyleResolver.h"
83 #include "core/dom/Attribute.h" 83 #include "core/dom/Attribute.h"
84 #include "core/dom/ContextFeatures.h" 84 #include "core/dom/ContextFeatures.h"
85 #include "core/dom/DocumentStyleSheetCollection.h" 85 #include "core/dom/DocumentStyleSheetCollection.h"
86 #include "core/dom/ElementShadow.h" 86 #include "core/dom/ElementShadow.h"
87 #include "core/dom/NodeRenderStyle.h" 87 #include "core/dom/NodeRenderStyle.h"
88 #include "core/dom/NodeRenderingContext.h" 88 #include "core/dom/NodeRenderingContext.h"
89 #include "core/dom/ShadowRoot.h" 89 #include "core/dom/ShadowRoot.h"
90 #include "core/dom/Text.h" 90 #include "core/dom/Text.h"
91 #include "core/dom/VisitedLinkState.h" 91 #include "core/dom/VisitedLinkState.h"
92 #include "core/dom/WebCoreMemoryInstrumentation.h" 92 #include "core/dom/WebCoreMemoryInstrumentation.h"
(...skipping 26 matching lines...) Expand all
119 #include "core/rendering/style/CursorList.h" 119 #include "core/rendering/style/CursorList.h"
120 #include "core/rendering/style/KeyframeList.h" 120 #include "core/rendering/style/KeyframeList.h"
121 #include "core/rendering/style/QuotesData.h" 121 #include "core/rendering/style/QuotesData.h"
122 #include "core/rendering/style/RenderStyleConstants.h" 122 #include "core/rendering/style/RenderStyleConstants.h"
123 #include "core/rendering/style/ShadowData.h" 123 #include "core/rendering/style/ShadowData.h"
124 #include "core/rendering/style/StyleCachedImage.h" 124 #include "core/rendering/style/StyleCachedImage.h"
125 #include "core/rendering/style/StyleGeneratedImage.h" 125 #include "core/rendering/style/StyleGeneratedImage.h"
126 #include "core/rendering/style/StylePendingImage.h" 126 #include "core/rendering/style/StylePendingImage.h"
127 #include "core/svg/SVGDocumentExtensions.h" 127 #include "core/svg/SVGDocumentExtensions.h"
128 #include "core/svg/SVGFontFaceElement.h" 128 #include "core/svg/SVGFontFaceElement.h"
129 #include <wtf/MemoryInstrumentationHashMap.h> 129 #include "wtf/MemoryInstrumentationHashMap.h"
130 #include <wtf/MemoryInstrumentationHashSet.h> 130 #include "wtf/MemoryInstrumentationHashSet.h"
131 #include <wtf/MemoryInstrumentationVector.h> 131 #include "wtf/MemoryInstrumentationVector.h"
132 #include <wtf/StdLibExtras.h> 132 #include "wtf/StdLibExtras.h"
133 #include <wtf/Vector.h> 133 #include "wtf/Vector.h"
134 134
135 #if ENABLE(SVG) 135 #if ENABLE(SVG)
136 #include "SVGNames.h" 136 #include "SVGNames.h"
137 #include "core/css/WebKitCSSSVGDocumentValue.h" 137 #include "core/css/WebKitCSSSVGDocumentValue.h"
138 #include "core/loader/cache/CachedSVGDocument.h" 138 #include "core/loader/cache/CachedSVGDocument.h"
139 #include "core/loader/cache/CachedSVGDocumentReference.h" 139 #include "core/loader/cache/CachedSVGDocumentReference.h"
140 #include "core/svg/SVGDocument.h" 140 #include "core/svg/SVGDocument.h"
141 #include "core/svg/SVGElement.h" 141 #include "core/svg/SVGElement.h"
142 #include "core/svg/SVGURIReference.h" 142 #include "core/svg/SVGURIReference.h"
143 #endif 143 #endif
144 144
145 #include "core/css/CSSImageSetValue.h" 145 #include "core/css/CSSImageSetValue.h"
146 #include "core/css/WebKitCSSMixFunctionValue.h" 146 #include "core/css/WebKitCSSMixFunctionValue.h"
147 #include "core/css/WebKitCSSShaderValue.h" 147 #include "core/css/WebKitCSSShaderValue.h"
148 #include "core/html/track/WebVTTElement.h"
148 #include "core/platform/graphics/filters/custom/CustomFilterArrayParameter.h" 149 #include "core/platform/graphics/filters/custom/CustomFilterArrayParameter.h"
149 #include "core/platform/graphics/filters/custom/CustomFilterConstants.h" 150 #include "core/platform/graphics/filters/custom/CustomFilterConstants.h"
150 #include "core/platform/graphics/filters/custom/CustomFilterNumberParameter.h" 151 #include "core/platform/graphics/filters/custom/CustomFilterNumberParameter.h"
151 #include "core/platform/graphics/filters/custom/CustomFilterOperation.h" 152 #include "core/platform/graphics/filters/custom/CustomFilterOperation.h"
152 #include "core/platform/graphics/filters/custom/CustomFilterParameter.h" 153 #include "core/platform/graphics/filters/custom/CustomFilterParameter.h"
153 #include "core/platform/graphics/filters/custom/CustomFilterProgramInfo.h" 154 #include "core/platform/graphics/filters/custom/CustomFilterProgramInfo.h"
154 #include "core/platform/graphics/filters/custom/CustomFilterTransformParameter.h " 155 #include "core/platform/graphics/filters/custom/CustomFilterTransformParameter.h "
155 #include "core/rendering/style/StyleCachedImageSet.h" 156 #include "core/rendering/style/StyleCachedImageSet.h"
156 #include "core/rendering/style/StyleCachedShader.h" 157 #include "core/rendering/style/StyleCachedShader.h"
157 #include "core/rendering/style/StyleCustomFilterProgram.h" 158 #include "core/rendering/style/StyleCustomFilterProgram.h"
158 #include "core/rendering/style/StyleCustomFilterProgramCache.h" 159 #include "core/rendering/style/StyleCustomFilterProgramCache.h"
159 #include "core/rendering/style/StylePendingShader.h" 160 #include "core/rendering/style/StylePendingShader.h"
160 #include "core/rendering/style/StyleShader.h" 161 #include "core/rendering/style/StyleShader.h"
161 162
162 #include "core/html/track/WebVTTElement.h"
163
164 using namespace std; 163 using namespace std;
165 164
166 namespace WTF { 165 namespace WTF {
167 166
168 template<> struct SequenceMemoryInstrumentationTraits<const WebCore::RuleData*> { 167 template<> struct SequenceMemoryInstrumentationTraits<const WebCore::RuleData*> {
169 template <typename I> static void reportMemoryUsage(I, I, MemoryClassInfo&) { } 168 template <typename I> static void reportMemoryUsage(I, I, MemoryClassInfo&) { }
170 }; 169 };
171 170
172 } 171 }
173 172
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 // First we match rules from the user agent sheet. 489 // First we match rules from the user agent sheet.
491 if (CSSDefaultStyleSheets::simpleDefaultStyleSheet) 490 if (CSSDefaultStyleSheets::simpleDefaultStyleSheet)
492 collector.matchedResult().isCacheable = false; 491 collector.matchedResult().isCacheable = false;
493 492
494 RuleSet* userAgentStyleSheet = m_medium->mediaTypeMatchSpecific("print") 493 RuleSet* userAgentStyleSheet = m_medium->mediaTypeMatchSpecific("print")
495 ? CSSDefaultStyleSheets::defaultPrintStyle : CSSDefaultStyleSheets::defa ultStyle; 494 ? CSSDefaultStyleSheets::defaultPrintStyle : CSSDefaultStyleSheets::defa ultStyle;
496 matchUARules(collector, userAgentStyleSheet); 495 matchUARules(collector, userAgentStyleSheet);
497 496
498 // In quirks mode, we match rules from the quirks user agent sheet. 497 // In quirks mode, we match rules from the quirks user agent sheet.
499 if (document()->inQuirksMode()) 498 if (document()->inQuirksMode())
500 matchUARules(collector, CSSDefaultStyleSheets::defaultQuirksStyle); 499 matchUARules(collector, CSSDefaultStyleSheets::defaultQuirksStyle);
501 500
502 // If document uses view source styles (in view source mode or in xml viewer mode), then we match rules from the view source style sheet. 501 // If document uses view source styles (in view source mode or in xml viewer mode), then we match rules from the view source style sheet.
503 if (document()->isViewSource()) 502 if (document()->isViewSource())
504 matchUARules(collector, CSSDefaultStyleSheets::viewSourceStyle()); 503 matchUARules(collector, CSSDefaultStyleSheets::viewSourceStyle());
505 504
506 collector.setMatchingUARules(false); 505 collector.setMatchingUARules(false);
507 } 506 }
508 507
509 void StyleResolver::matchUARules(ElementRuleCollector& collector, RuleSet* rules ) 508 void StyleResolver::matchUARules(ElementRuleCollector& collector, RuleSet* rules )
510 { 509 {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 } 541 }
543 } 542 }
544 543
545 // Check the rules in author sheets next. 544 // Check the rules in author sheets next.
546 if (matchAuthorAndUserStyles) 545 if (matchAuthorAndUserStyles)
547 matchAuthorRules(collector, false); 546 matchAuthorRules(collector, false);
548 547
549 // Now check our inline style attribute. 548 // Now check our inline style attribute.
550 if (matchAuthorAndUserStyles && m_state.styledElement() && m_state.styledEle ment()->inlineStyle()) { 549 if (matchAuthorAndUserStyles && m_state.styledElement() && m_state.styledEle ment()->inlineStyle()) {
551 // Inline style is immutable as long as there is no CSSOM wrapper. 550 // Inline style is immutable as long as there is no CSSOM wrapper.
552 // FIXME: Media control shadow trees seem to have problems with caching. 551 // FIXME: Media control shadow trees seem to have problems with caching.
553 bool isInlineStyleCacheable = !m_state.styledElement()->inlineStyle()->isM utable() && !m_state.styledElement()->isInShadowTree(); 552 bool isInlineStyleCacheable = !m_state.styledElement()->inlineStyle()->i sMutable() && !m_state.styledElement()->isInShadowTree();
554 // FIXME: Constify. 553 // FIXME: Constify.
555 collector.addElementStyleProperties(m_state.styledElement()->inlineStyle() , isInlineStyleCacheable); 554 collector.addElementStyleProperties(m_state.styledElement()->inlineStyle (), isInlineStyleCacheable);
556 } 555 }
557 556
558 #if ENABLE(SVG) 557 #if ENABLE(SVG)
559 // Now check SMIL animation override style. 558 // Now check SMIL animation override style.
560 if (includeSMILProperties && matchAuthorAndUserStyles && m_state.styledEleme nt() && m_state.styledElement()->isSVGElement()) 559 if (includeSMILProperties && matchAuthorAndUserStyles && m_state.styledEleme nt() && m_state.styledElement()->isSVGElement())
561 collector.addElementStyleProperties(toSVGElement(m_state.styledElement() )->animatedSMILStyleProperties(), false /* isCacheable */); 560 collector.addElementStyleProperties(toSVGElement(m_state.styledElement() )->animatedSMILStyleProperties(), false /* isCacheable */);
562 #else 561 #else
563 UNUSED_PARAM(includeSMILProperties); 562 UNUSED_PARAM(includeSMILProperties);
564 #endif 563 #endif
565 564
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 // Tracking child index requires unique style for each node. This may get se t by the sibling rule match above. 898 // Tracking child index requires unique style for each node. This may get se t by the sibling rule match above.
900 if (parentElementPreventsSharing(state.element()->parentElement())) 899 if (parentElementPreventsSharing(state.element()->parentElement()))
901 return 0; 900 return 0;
902 return shareElement->renderStyle(); 901 return shareElement->renderStyle();
903 } 902 }
904 903
905 static void setStylesForPaginationMode(Pagination::Mode paginationMode, RenderSt yle* style) 904 static void setStylesForPaginationMode(Pagination::Mode paginationMode, RenderSt yle* style)
906 { 905 {
907 if (paginationMode == Pagination::Unpaginated) 906 if (paginationMode == Pagination::Unpaginated)
908 return; 907 return;
909 908
910 switch (paginationMode) { 909 switch (paginationMode) {
911 case Pagination::LeftToRightPaginated: 910 case Pagination::LeftToRightPaginated:
912 style->setColumnAxis(HorizontalColumnAxis); 911 style->setColumnAxis(HorizontalColumnAxis);
913 if (style->isHorizontalWritingMode()) 912 if (style->isHorizontalWritingMode())
914 style->setColumnProgression(style->isLeftToRightDirection() ? Normal ColumnProgression : ReverseColumnProgression); 913 style->setColumnProgression(style->isLeftToRightDirection() ? Normal ColumnProgression : ReverseColumnProgression);
915 else 914 else
916 style->setColumnProgression(style->isFlippedBlocksWritingMode() ? Re verseColumnProgression : NormalColumnProgression); 915 style->setColumnProgression(style->isFlippedBlocksWritingMode() ? Re verseColumnProgression : NormalColumnProgression);
917 break; 916 break;
918 case Pagination::RightToLeftPaginated: 917 case Pagination::RightToLeftPaginated:
919 style->setColumnAxis(HorizontalColumnAxis); 918 style->setColumnAxis(HorizontalColumnAxis);
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 } 1093 }
1095 element->document()->setHasNodesWithPlaceholderStyle(); 1094 element->document()->setHasNodesWithPlaceholderStyle();
1096 return s_styleNotYetAvailable; 1095 return s_styleNotYetAvailable;
1097 } 1096 }
1098 1097
1099 StyleResolverState& state = m_state; 1098 StyleResolverState& state = m_state;
1100 initElement(element); 1099 initElement(element);
1101 state.initForStyleResolve(document(), element, defaultParent, regionForStyli ng); 1100 state.initForStyleResolve(document(), element, defaultParent, regionForStyli ng);
1102 if (sharingBehavior == AllowStyleSharing && !state.distributedToInsertionPoi nt()) { 1101 if (sharingBehavior == AllowStyleSharing && !state.distributedToInsertionPoi nt()) {
1103 RenderStyle* sharedStyle = locateSharedStyle(); 1102 RenderStyle* sharedStyle = locateSharedStyle();
1104 if (sharedStyle) 1103 if (sharedStyle) {
1105 {
1106 state.clear(); 1104 state.clear();
1107 return sharedStyle; 1105 return sharedStyle;
1108 } 1106 }
1109 } 1107 }
1110 1108
1111 if (state.parentStyle()) { 1109 if (state.parentStyle()) {
1112 state.setStyle(RenderStyle::create()); 1110 state.setStyle(RenderStyle::create());
1113 state.style()->inheritFrom(state.parentStyle(), isAtShadowBoundary(eleme nt) ? RenderStyle::AtShadowBoundary : RenderStyle::NotAtShadowBoundary); 1111 state.style()->inheritFrom(state.parentStyle(), isAtShadowBoundary(eleme nt) ? RenderStyle::AtShadowBoundary : RenderStyle::NotAtShadowBoundary);
1114 } else { 1112 } else {
1115 state.setStyle(defaultStyleForElement()); 1113 state.setStyle(defaultStyleForElement());
(...skipping 25 matching lines...) Expand all
1141 m_ruleSets.collectFeatures(document()->isViewSource(), m_scopeResolver.g et()); 1139 m_ruleSets.collectFeatures(document()->isViewSource(), m_scopeResolver.g et());
1142 m_inspectorCSSOMWrappers.reset(); 1140 m_inspectorCSSOMWrappers.reset();
1143 } 1141 }
1144 1142
1145 ElementRuleCollector collector(this, state); 1143 ElementRuleCollector collector(this, state);
1146 collector.setRegionForStyling(regionForStyling); 1144 collector.setRegionForStyling(regionForStyling);
1147 1145
1148 if (matchingBehavior == MatchOnlyUserAgentRules) 1146 if (matchingBehavior == MatchOnlyUserAgentRules)
1149 matchUARules(collector); 1147 matchUARules(collector);
1150 else 1148 else
1151 matchAllRules(collector, m_matchAuthorAndUserStyles, matchingBehavior != M atchAllRulesExcludingSMIL); 1149 matchAllRules(collector, m_matchAuthorAndUserStyles, matchingBehavior != MatchAllRulesExcludingSMIL);
1152 1150
1153 applyMatchedProperties(collector.matchedResult(), element); 1151 applyMatchedProperties(collector.matchedResult(), element);
1154 1152
1155 // Clean up our style object's display and text decorations (among other fix ups). 1153 // Clean up our style object's display and text decorations (among other fix ups).
1156 adjustRenderStyle(state.style(), state.parentStyle(), element); 1154 adjustRenderStyle(state.style(), state.parentStyle(), element);
1157 1155
1158 state.clear(); // Clear out for the next resolve. 1156 state.clear(); // Clear out for the next resolve.
1159 1157
1160 document()->didAccessStyleResolver(); 1158 document()->didAccessStyleResolver();
1161 1159
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 // Now do rest of the properties. 1191 // Now do rest of the properties.
1194 if (keyframe->properties()) 1192 if (keyframe->properties())
1195 applyMatchedProperties<LowPriorityProperties>(result, false, 0, result.m atchedProperties.size() - 1, inheritedOnly); 1193 applyMatchedProperties<LowPriorityProperties>(result, false, 0, result.m atchedProperties.size() - 1, inheritedOnly);
1196 1194
1197 // If our font got dirtied by one of the non-essential font props, 1195 // If our font got dirtied by one of the non-essential font props,
1198 // go ahead and update it a second time. 1196 // go ahead and update it a second time.
1199 updateFont(); 1197 updateFont();
1200 1198
1201 // Start loading resources referenced by this style. 1199 // Start loading resources referenced by this style.
1202 loadPendingResources(); 1200 loadPendingResources();
1203 1201
1204 // Add all the animating properties to the keyframe. 1202 // Add all the animating properties to the keyframe.
1205 if (const StylePropertySet* styleDeclaration = keyframe->properties()) { 1203 if (const StylePropertySet* styleDeclaration = keyframe->properties()) {
1206 unsigned propertyCount = styleDeclaration->propertyCount(); 1204 unsigned propertyCount = styleDeclaration->propertyCount();
1207 for (unsigned i = 0; i < propertyCount; ++i) { 1205 for (unsigned i = 0; i < propertyCount; ++i) {
1208 CSSPropertyID property = styleDeclaration->propertyAt(i).id(); 1206 CSSPropertyID property = styleDeclaration->propertyAt(i).id();
1209 // Timing-function within keyframes is special, because it is not an imated; it just 1207 // Timing-function within keyframes is special, because it is not an imated; it just
1210 // describes the timing function between this keyframe and the next. 1208 // describes the timing function between this keyframe and the next.
1211 if (property != CSSPropertyWebkitAnimationTimingFunction) 1209 if (property != CSSPropertyWebkitAnimationTimingFunction)
1212 keyframeValue.addProperty(property); 1210 keyframeValue.addProperty(property);
1213 } 1211 }
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 case TABLE_CAPTION: 1453 case TABLE_CAPTION:
1456 return BLOCK; 1454 return BLOCK;
1457 case NONE: 1455 case NONE:
1458 ASSERT_NOT_REACHED(); 1456 ASSERT_NOT_REACHED();
1459 return NONE; 1457 return NONE;
1460 } 1458 }
1461 ASSERT_NOT_REACHED(); 1459 ASSERT_NOT_REACHED();
1462 return BLOCK; 1460 return BLOCK;
1463 } 1461 }
1464 1462
1465 // CSS requires text-decoration to be reset at each DOM element for tables, 1463 // CSS requires text-decoration to be reset at each DOM element for tables,
1466 // inline blocks, inline tables, run-ins, shadow DOM crossings, floating element s, 1464 // inline blocks, inline tables, run-ins, shadow DOM crossings, floating element s,
1467 // and absolute or relatively positioned elements. 1465 // and absolute or relatively positioned elements.
1468 static bool doesNotInheritTextDecoration(RenderStyle* style, Element* e) 1466 static bool doesNotInheritTextDecoration(RenderStyle* style, Element* e)
1469 { 1467 {
1470 return style->display() == TABLE || style->display() == INLINE_TABLE || styl e->display() == RUN_IN 1468 return style->display() == TABLE || style->display() == INLINE_TABLE || styl e->display() == RUN_IN
1471 || style->display() == INLINE_BLOCK || style->display() == INLINE_BOX || isAtShadowBoundary(e) 1469 || style->display() == INLINE_BLOCK || style->display() == INLINE_BOX || isAtShadowBoundary(e)
1472 || style->isFloating() || style->hasOutOfFlowPosition(); 1470 || style->isFloating() || style->hasOutOfFlowPosition();
1473 } 1471 }
1474 1472
1475 static bool isDisplayFlexibleBox(EDisplay display) 1473 static bool isDisplayFlexibleBox(EDisplay display)
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1789 initElement(e); 1787 initElement(e);
1790 m_state.initForStyleResolve(document(), e, 0); 1788 m_state.initForStyleResolve(document(), e, 0);
1791 1789
1792 ElementRuleCollector collector(this, m_state); 1790 ElementRuleCollector collector(this, m_state);
1793 collector.setMode(SelectorChecker::CollectingRules); 1791 collector.setMode(SelectorChecker::CollectingRules);
1794 collector.setPseudoStyleRequest(PseudoStyleRequest(pseudoId)); 1792 collector.setPseudoStyleRequest(PseudoStyleRequest(pseudoId));
1795 1793
1796 if (rulesToInclude & UAAndUserCSSRules) { 1794 if (rulesToInclude & UAAndUserCSSRules) {
1797 // First we match rules from the user agent sheet. 1795 // First we match rules from the user agent sheet.
1798 matchUARules(collector); 1796 matchUARules(collector);
1799 1797
1800 // Now we check user sheet rules. 1798 // Now we check user sheet rules.
1801 if (m_matchAuthorAndUserStyles) 1799 if (m_matchAuthorAndUserStyles)
1802 matchUserRules(collector, rulesToInclude & EmptyCSSRules); 1800 matchUserRules(collector, rulesToInclude & EmptyCSSRules);
1803 } 1801 }
1804 1802
1805 if (m_matchAuthorAndUserStyles && (rulesToInclude & AuthorCSSRules)) { 1803 if (m_matchAuthorAndUserStyles && (rulesToInclude & AuthorCSSRules)) {
1806 collector.setSameOriginOnly(!(rulesToInclude & CrossOriginCSSRules)); 1804 collector.setSameOriginOnly(!(rulesToInclude & CrossOriginCSSRules));
1807 1805
1808 // Check the rules in author sheets. 1806 // Check the rules in author sheets.
1809 matchAuthorRules(collector, rulesToInclude & EmptyCSSRules); 1807 matchAuthorRules(collector, rulesToInclude & EmptyCSSRules);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1932 return; 1930 return;
1933 } 1931 }
1934 for (int i = startIndex; i <= endIndex; ++i) { 1932 for (int i = startIndex; i <= endIndex; ++i) {
1935 const MatchedProperties& matchedProperties = matchResult.matchedProperti es[i]; 1933 const MatchedProperties& matchedProperties = matchResult.matchedProperti es[i];
1936 applyProperties<pass>(matchedProperties.properties.get(), matchResult.ma tchedRules[i], isImportant, inheritedOnly, static_cast<PropertyWhitelistType>(ma tchedProperties.whitelistType)); 1934 applyProperties<pass>(matchedProperties.properties.get(), matchResult.ma tchedRules[i], isImportant, inheritedOnly, static_cast<PropertyWhitelistType>(ma tchedProperties.whitelistType));
1937 } 1935 }
1938 } 1936 }
1939 1937
1940 unsigned StyleResolver::computeMatchedPropertiesHash(const MatchedProperties* pr operties, unsigned size) 1938 unsigned StyleResolver::computeMatchedPropertiesHash(const MatchedProperties* pr operties, unsigned size)
1941 { 1939 {
1942 1940
1943 return StringHasher::hashMemory(properties, sizeof(MatchedProperties) * size ); 1941 return StringHasher::hashMemory(properties, sizeof(MatchedProperties) * size );
1944 } 1942 }
1945 1943
1946 bool operator==(const StyleResolver::MatchRanges& a, const StyleResolver::MatchR anges& b) 1944 bool operator==(const StyleResolver::MatchRanges& a, const StyleResolver::MatchR anges& b)
1947 { 1945 {
1948 return a.firstUARule == b.firstUARule 1946 return a.firstUARule == b.firstUARule
1949 && a.lastUARule == b.lastUARule 1947 && a.lastUARule == b.lastUARule
1950 && a.firstAuthorRule == b.firstAuthorRule 1948 && a.firstAuthorRule == b.firstAuthorRule
1951 && a.lastAuthorRule == b.lastAuthorRule 1949 && a.lastAuthorRule == b.lastAuthorRule
1952 && a.firstUserRule == b.firstUserRule 1950 && a.firstUserRule == b.firstUserRule
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
2037 2035
2038 void StyleResolver::applyMatchedProperties(const MatchResult& matchResult, const Element* element) 2036 void StyleResolver::applyMatchedProperties(const MatchResult& matchResult, const Element* element)
2039 { 2037 {
2040 ASSERT(element); 2038 ASSERT(element);
2041 StyleResolverState& state = m_state; 2039 StyleResolverState& state = m_state;
2042 unsigned cacheHash = matchResult.isCacheable ? computeMatchedPropertiesHash( matchResult.matchedProperties.data(), matchResult.matchedProperties.size()) : 0; 2040 unsigned cacheHash = matchResult.isCacheable ? computeMatchedPropertiesHash( matchResult.matchedProperties.data(), matchResult.matchedProperties.size()) : 0;
2043 bool applyInheritedOnly = false; 2041 bool applyInheritedOnly = false;
2044 const MatchedPropertiesCacheItem* cacheItem = 0; 2042 const MatchedPropertiesCacheItem* cacheItem = 0;
2045 if (cacheHash && (cacheItem = findFromMatchedPropertiesCache(cacheHash, matc hResult))) { 2043 if (cacheHash && (cacheItem = findFromMatchedPropertiesCache(cacheHash, matc hResult))) {
2046 // We can build up the style by copying non-inherited properties from an earlier style object built using the same exact 2044 // We can build up the style by copying non-inherited properties from an earlier style object built using the same exact
2047 // style declarations. We then only need to apply the inherited properti es, if any, as their values can depend on the 2045 // style declarations. We then only need to apply the inherited properti es, if any, as their values can depend on the
2048 // element context. This is fast and saves memory by reusing the style d ata structures. 2046 // element context. This is fast and saves memory by reusing the style d ata structures.
2049 state.style()->copyNonInheritedFrom(cacheItem->renderStyle.get()); 2047 state.style()->copyNonInheritedFrom(cacheItem->renderStyle.get());
2050 if (state.parentStyle()->inheritedDataShared(cacheItem->parentRenderStyl e.get()) && !isAtShadowBoundary(element)) { 2048 if (state.parentStyle()->inheritedDataShared(cacheItem->parentRenderStyl e.get()) && !isAtShadowBoundary(element)) {
2051 EInsideLink linkStatus = state.style()->insideLink(); 2049 EInsideLink linkStatus = state.style()->insideLink();
2052 // If the cache item parent style has identical inherited properties to the current parent style then the 2050 // If the cache item parent style has identical inherited properties to the current parent style then the
2053 // resulting style will be identical too. We copy the inherited prop erties over from the cache and are done. 2051 // resulting style will be identical too. We copy the inherited prop erties over from the cache and are done.
2054 state.style()->inheritFrom(cacheItem->renderStyle.get()); 2052 state.style()->inheritFrom(cacheItem->renderStyle.get());
2055 2053
2056 // Unfortunately the link status is treated like an inherited proper ty. We need to explicitly restore it. 2054 // Unfortunately the link status is treated like an inherited proper ty. We need to explicitly restore it.
2057 state.style()->setInsideLink(linkStatus); 2055 state.style()->setInsideLink(linkStatus);
2058 return; 2056 return;
2059 } 2057 }
2060 applyInheritedOnly = true; 2058 applyInheritedOnly = true;
2061 } 2059 }
2062 2060
2063 // First apply all variable definitions, as they may be used during applicat ion of later properties. 2061 // First apply all variable definitions, as they may be used during applicat ion of later properties.
2064 applyMatchedProperties<VariableDefinitions>(matchResult, false, 0, matchResu lt.matchedProperties.size() - 1, applyInheritedOnly); 2062 applyMatchedProperties<VariableDefinitions>(matchResult, false, 0, matchResu lt.matchedProperties.size() - 1, applyInheritedOnly);
2065 applyMatchedProperties<VariableDefinitions>(matchResult, true, matchResult.r anges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedOnly); 2063 applyMatchedProperties<VariableDefinitions>(matchResult, true, matchResult.r anges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedOnly);
2066 applyMatchedProperties<VariableDefinitions>(matchResult, true, matchResult.r anges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly); 2064 applyMatchedProperties<VariableDefinitions>(matchResult, true, matchResult.r anges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly);
2067 applyMatchedProperties<VariableDefinitions>(matchResult, true, matchResult.r anges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); 2065 applyMatchedProperties<VariableDefinitions>(matchResult, true, matchResult.r anges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
2068 2066
2069 // Now we have all of the matched rules in the appropriate order. Walk the r ules and apply 2067 // Now we have all of the matched rules in the appropriate order. Walk the r ules and apply
2070 // high-priority properties first, i.e., those properties that other propert ies depend on. 2068 // high-priority properties first, i.e., those properties that other propert ies depend on.
(...skipping 19 matching lines...) Expand all
2090 // Line-height is set when we are sure we decided on the font-size. 2088 // Line-height is set when we are sure we decided on the font-size.
2091 if (state.lineHeightValue()) 2089 if (state.lineHeightValue())
2092 applyProperty(CSSPropertyLineHeight, state.lineHeightValue()); 2090 applyProperty(CSSPropertyLineHeight, state.lineHeightValue());
2093 2091
2094 // Many properties depend on the font. If it changes we just apply all prope rties. 2092 // Many properties depend on the font. If it changes we just apply all prope rties.
2095 if (cacheItem && cacheItem->renderStyle->fontDescription() != state.style()- >fontDescription()) 2093 if (cacheItem && cacheItem->renderStyle->fontDescription() != state.style()- >fontDescription())
2096 applyInheritedOnly = false; 2094 applyInheritedOnly = false;
2097 2095
2098 // Now do the normal priority UA properties. 2096 // Now do the normal priority UA properties.
2099 applyMatchedProperties<LowPriorityProperties>(matchResult, false, matchResul t.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); 2097 applyMatchedProperties<LowPriorityProperties>(matchResult, false, matchResul t.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
2100 2098
2101 // Cache our border and background so that we can examine them later. 2099 // Cache our border and background so that we can examine them later.
2102 state.cacheBorderAndBackground(); 2100 state.cacheBorderAndBackground();
2103 2101
2104 // Now do the author and user normal priority properties and all the !import ant properties. 2102 // Now do the author and user normal priority properties and all the !import ant properties.
2105 applyMatchedProperties<LowPriorityProperties>(matchResult, false, matchResul t.ranges.lastUARule + 1, matchResult.matchedProperties.size() - 1, applyInherite dOnly); 2103 applyMatchedProperties<LowPriorityProperties>(matchResult, false, matchResul t.ranges.lastUARule + 1, matchResult.matchedProperties.size() - 1, applyInherite dOnly);
2106 if (RuntimeEnabledFeatures::webAnimationEnabled()) 2104 if (RuntimeEnabledFeatures::webAnimationEnabled())
2107 applyAnimatedProperties<LowPriorityProperties>(element); 2105 applyAnimatedProperties<LowPriorityProperties>(element);
2108 applyMatchedProperties<LowPriorityProperties>(matchResult, true, matchResult .ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedOnly); 2106 applyMatchedProperties<LowPriorityProperties>(matchResult, true, matchResult .ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedOnly);
2109 applyMatchedProperties<LowPriorityProperties>(matchResult, true, matchResult .ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly); 2107 applyMatchedProperties<LowPriorityProperties>(matchResult, true, matchResult .ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly);
2110 applyMatchedProperties<LowPriorityProperties>(matchResult, true, matchResult .ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); 2108 applyMatchedProperties<LowPriorityProperties>(matchResult, true, matchResult .ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
2111 2109
2112 // Start loading resources referenced by this style. 2110 // Start loading resources referenced by this style.
2113 loadPendingResources(); 2111 loadPendingResources();
2114 2112
2115 ASSERT(!state.fontDirty()); 2113 ASSERT(!state.fontDirty());
2116 2114
2117 if (cacheItem || !cacheHash) 2115 if (cacheItem || !cacheHash)
2118 return; 2116 return;
2119 if (!isCacheableInMatchedPropertiesCache(state.element(), state.style(), sta te.parentStyle())) 2117 if (!isCacheableInMatchedPropertiesCache(state.element(), state.style(), sta te.parentStyle()))
2120 return; 2118 return;
2121 addToMatchedPropertiesCache(state.style(), state.parentStyle(), cacheHash, m atchResult); 2119 addToMatchedPropertiesCache(state.style(), state.parentStyle(), cacheHash, m atchResult);
2122 } 2120 }
2123 2121
2124 void StyleResolver::applyPropertyToStyle(CSSPropertyID id, CSSValue* value, Rend erStyle* style) 2122 void StyleResolver::applyPropertyToStyle(CSSPropertyID id, CSSValue* value, Rend erStyle* style)
2125 { 2123 {
2126 initElement(0); 2124 initElement(0);
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
2893 case CSSPropertyTextUnderlineMode: 2891 case CSSPropertyTextUnderlineMode:
2894 case CSSPropertyTextUnderlineStyle: 2892 case CSSPropertyTextUnderlineStyle:
2895 case CSSPropertyTextUnderlineWidth: 2893 case CSSPropertyTextUnderlineWidth:
2896 case CSSPropertyWebkitFontSizeDelta: 2894 case CSSPropertyWebkitFontSizeDelta:
2897 case CSSPropertyWebkitTextDecorationsInEffect: 2895 case CSSPropertyWebkitTextDecorationsInEffect:
2898 return; 2896 return;
2899 2897
2900 // CSS Text Layout Module Level 3: Vertical writing support 2898 // CSS Text Layout Module Level 3: Vertical writing support
2901 case CSSPropertyWebkitWritingMode: { 2899 case CSSPropertyWebkitWritingMode: {
2902 HANDLE_INHERIT_AND_INITIAL(writingMode, WritingMode); 2900 HANDLE_INHERIT_AND_INITIAL(writingMode, WritingMode);
2903 2901
2904 if (primitiveValue) 2902 if (primitiveValue)
2905 setWritingMode(*primitiveValue); 2903 setWritingMode(*primitiveValue);
2906 2904
2907 // FIXME: It is not ok to modify document state while applying style. 2905 // FIXME: It is not ok to modify document state while applying style.
2908 if (state.element() && state.element() == state.document()->documentElem ent()) 2906 if (state.element() && state.element() == state.document()->documentElem ent())
2909 state.document()->setWritingModeSetOnDocumentElement(true); 2907 state.document()->setWritingModeSetOnDocumentElement(true);
2910 return; 2908 return;
2911 } 2909 }
2912 2910
2913 case CSSPropertyWebkitTextOrientation: { 2911 case CSSPropertyWebkitTextOrientation: {
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
3383 // multiplying by our scale factor. 3381 // multiplying by our scale factor.
3384 float size; 3382 float size;
3385 if (childFont.keywordSize()) 3383 if (childFont.keywordSize())
3386 size = fontSizeForKeyword(document(), CSSValueXxSmall + childFont.keywor dSize() - 1, childFont.useFixedDefaultSize()); 3384 size = fontSizeForKeyword(document(), CSSValueXxSmall + childFont.keywor dSize() - 1, childFont.useFixedDefaultSize());
3387 else { 3385 else {
3388 Settings* settings = documentSettings(); 3386 Settings* settings = documentSettings();
3389 float fixedScaleFactor = (settings && settings->defaultFixedFontSize() & & settings->defaultFontSize()) 3387 float fixedScaleFactor = (settings && settings->defaultFixedFontSize() & & settings->defaultFontSize())
3390 ? static_cast<float>(settings->defaultFixedFontSize()) / settings->d efaultFontSize() 3388 ? static_cast<float>(settings->defaultFixedFontSize()) / settings->d efaultFontSize()
3391 : 1; 3389 : 1;
3392 size = parentFont.useFixedDefaultSize() ? 3390 size = parentFont.useFixedDefaultSize() ?
3393 childFont.specifiedSize() / fixedScaleFactor : 3391 childFont.specifiedSize() / fixedScaleFactor :
3394 childFont.specifiedSize() * fixedScaleFactor; 3392 childFont.specifiedSize() * fixedScaleFactor;
3395 } 3393 }
3396 3394
3397 FontDescription newFontDescription(childFont); 3395 FontDescription newFontDescription(childFont);
3398 setFontSize(newFontDescription, size); 3396 setFontSize(newFontDescription, size);
3399 style->setFontDescription(newFontDescription); 3397 style->setFontDescription(newFontDescription);
3400 } 3398 }
3401 3399
3402 void StyleResolver::initializeFontStyle(Settings* settings) 3400 void StyleResolver::initializeFontStyle(Settings* settings)
3403 { 3401 {
3404 FontDescription fontDescription; 3402 FontDescription fontDescription;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
3478 return min(maximumAllowedFontSize, zoomedSize); 3476 return min(maximumAllowedFontSize, zoomedSize);
3479 } 3477 }
3480 3478
3481 const int fontSizeTableMax = 16; 3479 const int fontSizeTableMax = 16;
3482 const int fontSizeTableMin = 9; 3480 const int fontSizeTableMin = 9;
3483 const int totalKeywords = 8; 3481 const int totalKeywords = 8;
3484 3482
3485 // WinIE/Nav4 table for font sizes. Designed to match the legacy font mapping sy stem of HTML. 3483 // WinIE/Nav4 table for font sizes. Designed to match the legacy font mapping sy stem of HTML.
3486 static const int quirksFontSizeTable[fontSizeTableMax - fontSizeTableMin + 1][to talKeywords] = 3484 static const int quirksFontSizeTable[fontSizeTableMax - fontSizeTableMin + 1][to talKeywords] =
3487 { 3485 {
3488 { 9, 9, 9, 9, 11, 14, 18, 28 }, 3486 { 9, 9, 9, 9, 11, 14, 18, 28 },
3489 { 9, 9, 9, 10, 12, 15, 20, 31 }, 3487 { 9, 9, 9, 10, 12, 15, 20, 31 },
3490 { 9, 9, 9, 11, 13, 17, 22, 34 }, 3488 { 9, 9, 9, 11, 13, 17, 22, 34 },
3491 { 9, 9, 10, 12, 14, 18, 24, 37 }, 3489 { 9, 9, 10, 12, 14, 18, 24, 37 },
3492 { 9, 9, 10, 13, 16, 20, 26, 40 }, // fixed font defau lt (13) 3490 { 9, 9, 10, 13, 16, 20, 26, 40 }, // fixed font default (13)
3493 { 9, 9, 11, 14, 17, 21, 28, 42 }, 3491 { 9, 9, 11, 14, 17, 21, 28, 42 },
3494 { 9, 10, 12, 15, 17, 23, 30, 45 }, 3492 { 9, 10, 12, 15, 17, 23, 30, 45 },
3495 { 9, 10, 13, 16, 18, 24, 32, 48 } // proportional font default (16) 3493 { 9, 10, 13, 16, 18, 24, 32, 48 } // proportional font d efault (16)
3496 }; 3494 };
3497 // HTML 1 2 3 4 5 6 7 3495 // HTML 1 2 3 4 5 6 7
3498 // CSS xxs xs s m l xl xxl 3496 // CSS xxs xs s m l xl xxl
3499 // | 3497 // |
3500 // user pref 3498 // user pref
3501 3499
3502 // Strict mode table matches MacIE and Mozilla's settings exactly. 3500 // Strict mode table matches MacIE and Mozilla's settings exactly.
3503 static const int strictFontSizeTable[fontSizeTableMax - fontSizeTableMin + 1][to talKeywords] = 3501 static const int strictFontSizeTable[fontSizeTableMax - fontSizeTableMin + 1][to talKeywords] =
3504 { 3502 {
3505 { 9, 9, 9, 9, 11, 14, 18, 27 }, 3503 { 9, 9, 9, 9, 11, 14, 18, 27 },
3506 { 9, 9, 9, 10, 12, 15, 20, 30 }, 3504 { 9, 9, 9, 10, 12, 15, 20, 30 },
3507 { 9, 9, 10, 11, 13, 17, 22, 33 }, 3505 { 9, 9, 10, 11, 13, 17, 22, 33 },
3508 { 9, 9, 10, 12, 14, 18, 24, 36 }, 3506 { 9, 9, 10, 12, 14, 18, 24, 36 },
3509 { 9, 10, 12, 13, 16, 20, 26, 39 }, // fixed font defau lt (13) 3507 { 9, 10, 12, 13, 16, 20, 26, 39 }, // fixed font default (13)
3510 { 9, 10, 12, 14, 17, 21, 28, 42 }, 3508 { 9, 10, 12, 14, 17, 21, 28, 42 },
3511 { 9, 10, 13, 15, 18, 23, 30, 45 }, 3509 { 9, 10, 13, 15, 18, 23, 30, 45 },
3512 { 9, 10, 13, 16, 18, 24, 32, 48 } // proportional font default (16) 3510 { 9, 10, 13, 16, 18, 24, 32, 48 } // proportional font d efault (16)
3513 }; 3511 };
3514 // HTML 1 2 3 4 5 6 7 3512 // HTML 1 2 3 4 5 6 7
3515 // CSS xxs xs s m l xl xxl 3513 // CSS xxs xs s m l xl xxl
3516 // | 3514 // |
3517 // user pref 3515 // user pref
3518 3516
3519 // For values outside the range of the table, we use Todd Fahrner's suggested sc ale 3517 // For values outside the range of the table, we use Todd Fahrner's suggested sc ale
3520 // factors for each keyword value. 3518 // factors for each keyword value.
3521 static const float fontSizeFactors[totalKeywords] = { 0.60f, 0.75f, 0.89f, 1.0f, 1.2f, 1.5f, 2.0f, 3.0f }; 3519 static const float fontSizeFactors[totalKeywords] = { 0.60f, 0.75f, 0.89f, 1.0f, 1.2f, 1.5f, 2.0f, 3.0f };
3522 3520
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
3775 m_state.pendingImageProperties().clear(); 3773 m_state.pendingImageProperties().clear();
3776 } 3774 }
3777 3775
3778 void StyleResolver::loadPendingResources() 3776 void StyleResolver::loadPendingResources()
3779 { 3777 {
3780 // Start loading images referenced by this style. 3778 // Start loading images referenced by this style.
3781 loadPendingImages(); 3779 loadPendingImages();
3782 3780
3783 // Start loading the shaders referenced by this style. 3781 // Start loading the shaders referenced by this style.
3784 loadPendingShaders(); 3782 loadPendingShaders();
3785 3783
3786 #if ENABLE(SVG) 3784 #if ENABLE(SVG)
3787 // Start loading the SVG Documents referenced by this style. 3785 // Start loading the SVG Documents referenced by this style.
3788 loadPendingSVGDocuments(); 3786 loadPendingSVGDocuments();
3789 #endif 3787 #endif
3790 } 3788 }
3791 3789
3792 inline StyleResolver::MatchedProperties::MatchedProperties() 3790 inline StyleResolver::MatchedProperties::MatchedProperties()
3793 : possiblyPaddedMember(0) 3791 : possiblyPaddedMember(0)
3794 { 3792 {
3795 } 3793 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
3835 info.addMember(m_viewportDependentMediaQueryResults, "viewportDependentMedia QueryResults"); 3833 info.addMember(m_viewportDependentMediaQueryResults, "viewportDependentMedia QueryResults");
3836 info.ignoreMember(m_styleBuilder); 3834 info.ignoreMember(m_styleBuilder);
3837 info.addMember(m_inspectorCSSOMWrappers); 3835 info.addMember(m_inspectorCSSOMWrappers);
3838 info.addMember(m_scopeResolver, "scopeResolver"); 3836 info.addMember(m_scopeResolver, "scopeResolver");
3839 3837
3840 info.addMember(m_state, "state"); 3838 info.addMember(m_state, "state");
3841 3839
3842 // FIXME: move this to a place where it would be called only once? 3840 // FIXME: move this to a place where it would be called only once?
3843 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle"); 3841 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle");
3844 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl e"); 3842 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl e");
3845 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle,"defaultPrintStyle") ; 3843 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle, "defaultPrintStyle" );
3846 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo urceStyle"); 3844 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo urceStyle");
3847 } 3845 }
3848 3846
3849 } // namespace WebCore 3847 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleResolver.h ('k') | Source/core/css/resolver/StyleResolverState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698