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

Side by Side Diff: Source/core/css/MediaQueryEvaluator.h

Issue 405953002: Fix MQEvaluator::mediaType() related perf regressions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Changed approach Created 6 years, 5 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
OLDNEW
1 /* 1 /*
2 * CSS Media Query Evaluator 2 * CSS Media Query Evaluator
3 * 3 *
4 * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>. 4 * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 explicit MediaQueryEvaluator(bool mediaFeatureResult = false); 62 explicit MediaQueryEvaluator(bool mediaFeatureResult = false);
63 63
64 // Creates evaluator which evaluates only simple media queries 64 // Creates evaluator which evaluates only simple media queries
65 // Evaluator returns true for acceptedMediaType and returns value of \media featureResult 65 // Evaluator returns true for acceptedMediaType and returns value of \media featureResult
66 // for any media features 66 // for any media features
67 67
68 MediaQueryEvaluator(const char* acceptedMediaType, bool mediaFeatureResult = false); 68 MediaQueryEvaluator(const char* acceptedMediaType, bool mediaFeatureResult = false);
69 69
70 // Creates evaluator which evaluates full media queries 70 // Creates evaluator which evaluates full media queries
71 MediaQueryEvaluator(LocalFrame*); 71 explicit MediaQueryEvaluator(LocalFrame*);
72 72
73 // Creates evaluator which evaluates in a thread-safe manner a subset of med ia values 73 // Creates evaluator which evaluates in a thread-safe manner a subset of med ia values
74 MediaQueryEvaluator(const MediaValues&); 74 explicit MediaQueryEvaluator(const MediaValues&);
75 75
76 ~MediaQueryEvaluator(); 76 ~MediaQueryEvaluator();
77 77
78 bool mediaTypeMatch(const String& mediaTypeToMatch) const; 78 bool mediaTypeMatch(const String& mediaTypeToMatch) const;
79 bool mediaTypeMatchSpecific(const char* mediaTypeToMatch) const;
80 79
81 // Evaluates a list of media queries 80 // Evaluates a list of media queries
82 bool eval(const MediaQuerySet*, MediaQueryResultList* = 0) const; 81 bool eval(const MediaQuerySet*, MediaQueryResultList* = 0) const;
83 82
84 // Evaluates media query subexpression, ie "and (media-feature: value)" part 83 // Evaluates media query subexpression, ie "and (media-feature: value)" part
85 bool eval(const MediaQueryExp*) const; 84 bool eval(const MediaQueryExp*) const;
86 85
87 private: 86 private:
88 const String mediaType() const; 87 const String mediaType() const;
89 88
90 String m_mediaType; 89 String m_mediaType;
91 bool m_expectedResult; 90 bool m_expectedResult;
92 RefPtr<MediaValues> m_mediaValues; 91 RefPtr<MediaValues> m_mediaValues;
93 }; 92 };
94 93
95 } // namespace 94 } // namespace
96 #endif 95 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/core/css/MediaQueryEvaluator.cpp » ('j') | Source/core/css/resolver/StyleResolver.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698