- Don't use hasPseudoId() optimization for pseudo styles used in shadow trees. These styles
generally exist when asked for so the optimization does not do much. This reverses the continuing
growth of the _pseudoBits bitfield in RenderStyle.
- Add some pseudo elements for media controls
* css/CSSSelector.cpp:
(WebCore::CSSSelector::extractPseudoType):
* css/CSSSelector.h:
(WebCore::CSSSelector::):
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::matchRulesForList):
(WebCore::CSSStyleSelector::checkOneSelector):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::getPseudoStyle):
* rendering/RenderStyle.cpp:
(WebCore::pseudoBit):
(WebCore::RenderStyle::hasPseudoStyle):
(WebCore::RenderStyle::setHasPseudoStyle):
* rendering/RenderStyle.h:
(WebCore::RenderStyle::):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@28084
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-11-27 Antti Koivisto <antti@apple.com>
+
+ Reviewed by Darin.
+
+ - Don't use hasPseudoId() optimization for pseudo styles used in shadow trees. These styles
+ generally exist when asked for so the optimization does not do much. This reverses the continuing
+ growth of the _pseudoBits bitfield in RenderStyle.
+ - Add some pseudo elements for media controls
+
+ * css/CSSSelector.cpp:
+ (WebCore::CSSSelector::extractPseudoType):
+ * css/CSSSelector.h:
+ (WebCore::CSSSelector::):
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::matchRulesForList):
+ (WebCore::CSSStyleSelector::checkOneSelector):
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::getPseudoStyle):
+ * rendering/RenderStyle.cpp:
+ (WebCore::pseudoBit):
+ (WebCore::RenderStyle::hasPseudoStyle):
+ (WebCore::RenderStyle::setHasPseudoStyle):
+ * rendering/RenderStyle.h:
+ (WebCore::RenderStyle::):
+
2007-11-27 Timothy Hatcher <timothy@apple.com>
Reviewed by Kevin McCullough.
static AtomicString indeterminate("indeterminate");
static AtomicString link("link");
static AtomicString lang("lang(");
+ static AtomicString mediaControlsPanel("-webkit-media-controls-panel");
+ static AtomicString mediaControlsMuteButton("-webkit-media-controls-mute-button");
+ static AtomicString mediaControlsPlayButton("-webkit-media-controls-play-button");
+ static AtomicString mediaControlsTimeDisplay("-webkit-media-controls-time-display");
+ static AtomicString mediaControlsTimeline("-webkit-media-controls-timeline");
static AtomicString notStr("not(");
static AtomicString root("root");
static AtomicString searchCancelButton("-webkit-search-cancel-button");
m_pseudoType = PseudoLink;
else if (m_value == lang)
m_pseudoType = PseudoLang;
- else if (m_value == notStr)
+ else if (m_value == mediaControlsPanel) {
+ m_pseudoType = PseudoMediaControlsPanel;
+ element = true;
+ } else if (m_value == mediaControlsMuteButton) {
+ m_pseudoType = PseudoMediaControlsMuteButton;
+ element = true;
+ } else if (m_value == mediaControlsPlayButton) {
+ m_pseudoType = PseudoMediaControlsPlayButton;
+ element = true;
+ } else if (m_value == mediaControlsTimeDisplay) {
+ m_pseudoType = PseudoMediaControlsTimeDisplay;
+ element = true;
+ } else if (m_value == mediaControlsTimeline) {
+ m_pseudoType = PseudoMediaControlsTimeline;
+ element = true;
+ } else if (m_value == notStr)
m_pseudoType = PseudoNot;
else if (m_value == root)
m_pseudoType = PseudoRoot;
PseudoSearchCancelButton,
PseudoSearchDecoration,
PseudoSearchResultsDecoration,
- PseudoSearchResultsButton
+ PseudoSearchResultsButton,
+ PseudoMediaControlsPanel,
+ PseudoMediaControlsMuteButton,
+ PseudoMediaControlsPlayButton,
+ PseudoMediaControlsTimeDisplay,
+ PseudoMediaControlsTimeline
};
PseudoType pseudoType() const
if (dynamicPseudo != RenderStyle::NOPSEUDO && pseudoStyle == RenderStyle::NOPSEUDO) {
if (m_collectRulesOnly)
return;
- style->setHasPseudoStyle(dynamicPseudo);
+ if (dynamicPseudo < RenderStyle::FIRST_INTERNAL_PSEUDOID)
+ style->setHasPseudoStyle(dynamicPseudo);
} else {
// Update our first/last rule indices in the matched rules array.
lastRuleIndex = m_matchedDecls.size() + m_matchedRules.size();
case CSSSelector::PseudoSearchResultsButton:
dynamicPseudo = RenderStyle::SEARCH_RESULTS_BUTTON;
return true;
+ case CSSSelector::PseudoMediaControlsPanel:
+ dynamicPseudo = RenderStyle::MEDIA_CONTROLS_PANEL;
+ return true;
+ case CSSSelector::PseudoMediaControlsMuteButton:
+ dynamicPseudo = RenderStyle::MEDIA_CONTROLS_MUTE_BUTTON;
+ return true;
+ case CSSSelector::PseudoMediaControlsPlayButton:
+ dynamicPseudo = RenderStyle::MEDIA_CONTROLS_PLAY_BUTTON;
+ return true;
+ case CSSSelector::PseudoMediaControlsTimeDisplay:
+ dynamicPseudo = RenderStyle::MEDIA_CONTROLS_TIME_DISPLAY;
+ return true;
+ case CSSSelector::PseudoMediaControlsTimeline:
+ dynamicPseudo = RenderStyle::MEDIA_CONTROLS_TIMELINE;
+ return true;
case CSSSelector::PseudoUnknown:
case CSSSelector::PseudoNotParsed:
default:
RenderStyle* RenderObject::getPseudoStyle(RenderStyle::PseudoId pseudo, RenderStyle* parentStyle) const
{
- if (!style()->hasPseudoStyle(pseudo))
+ if (pseudo < RenderStyle::FIRST_INTERNAL_PSEUDOID && !style()->hasPseudoStyle(pseudo))
return 0;
if (!parentStyle)
return this != CSSStyleSelector::styleNotYetAvailable;
}
-enum EPseudoBit { NO_BIT = 0x0, BEFORE_BIT = 0x1, AFTER_BIT = 0x2, FIRST_LINE_BIT = 0x4,
- FIRST_LETTER_BIT = 0x8, SELECTION_BIT = 0x10, FIRST_LINE_INHERITED_BIT = 0x20,
- FILE_UPLOAD_BUTTON_BIT = 0x40, SLIDER_THUMB_BIT = 0x80, SEARCH_CANCEL_BUTTON_BIT = 0x100, SEARCH_DECORATION_BIT = 0x200,
- SEARCH_RESULTS_DECORATION_BIT = 0x400, SEARCH_RESULTS_BUTTON_BIT = 0x800 };
-
static inline int pseudoBit(RenderStyle::PseudoId pseudo)
{
- switch (pseudo) {
- case RenderStyle::BEFORE:
- return BEFORE_BIT;
- case RenderStyle::AFTER:
- return AFTER_BIT;
- case RenderStyle::FIRST_LINE:
- return FIRST_LINE_BIT;
- case RenderStyle::FIRST_LETTER:
- return FIRST_LETTER_BIT;
- case RenderStyle::SELECTION:
- return SELECTION_BIT;
- case RenderStyle::FIRST_LINE_INHERITED:
- return FIRST_LINE_INHERITED_BIT;
- case RenderStyle::FILE_UPLOAD_BUTTON:
- return FILE_UPLOAD_BUTTON_BIT;
- case RenderStyle::SLIDER_THUMB:
- return SLIDER_THUMB_BIT;
- case RenderStyle::SEARCH_CANCEL_BUTTON:
- return SEARCH_CANCEL_BUTTON_BIT;
- case RenderStyle::SEARCH_DECORATION:
- return SEARCH_DECORATION_BIT;
- case RenderStyle::SEARCH_RESULTS_DECORATION:
- return SEARCH_RESULTS_DECORATION_BIT;
- case RenderStyle::SEARCH_RESULTS_BUTTON:
- return SEARCH_RESULTS_BUTTON_BIT;
- default:
- return NO_BIT;
- }
+ return 1 << (pseudo - 1);
}
bool RenderStyle::hasPseudoStyle(PseudoId pseudo) const
{
+ ASSERT(pseudo > NOPSEUDO);
+ ASSERT(pseudo < FIRST_INTERNAL_PSEUDOID);
return pseudoBit(pseudo) & noninherited_flags._pseudoBits;
}
void RenderStyle::setHasPseudoStyle(PseudoId pseudo)
{
+ ASSERT(pseudo > NOPSEUDO);
+ ASSERT(pseudo < FIRST_INTERNAL_PSEUDOID);
noninherited_flags._pseudoBits |= pseudoBit(pseudo);
}
public:
// static pseudo styles. Dynamic ones are produced on the fly.
enum PseudoId { NOPSEUDO, FIRST_LINE, FIRST_LETTER, BEFORE, AFTER, SELECTION, FIRST_LINE_INHERITED, FILE_UPLOAD_BUTTON, SLIDER_THUMB,
- SEARCH_CANCEL_BUTTON, SEARCH_DECORATION, SEARCH_RESULTS_DECORATION, SEARCH_RESULTS_BUTTON };
+ SEARCH_CANCEL_BUTTON, SEARCH_DECORATION, SEARCH_RESULTS_DECORATION, SEARCH_RESULTS_BUTTON, MEDIA_CONTROLS_PANEL,
+ MEDIA_CONTROLS_PLAY_BUTTON, MEDIA_CONTROLS_MUTE_BUTTON, MEDIA_CONTROLS_TIMELINE, MEDIA_CONTROLS_TIME_DISPLAY };
+ static const int FIRST_INTERNAL_PSEUDOID = FILE_UPLOAD_BUTTON;
void ref() { m_ref++; }
void deref(RenderArena* arena) {
unsigned _page_break_before : 2; // EPageBreak
unsigned _page_break_after : 2; // EPageBreak
- unsigned _styleType : 4; // PseudoId
+ unsigned _styleType : 5; // PseudoId
bool _affectedByHover : 1;
bool _affectedByActive : 1;
bool _affectedByDrag : 1;
- unsigned _pseudoBits : 12;
+ unsigned _pseudoBits : 6;
unsigned _unicodeBidi : 2; // EUnicodeBidi
} noninherited_flags;