OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010, Google Inc. All rights reserved. | 2 * Copyright (C) 2010, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 static const char kRuleRecordingEnabled[] = "ruleRecordingEnabled"; | 309 static const char kRuleRecordingEnabled[] = "ruleRecordingEnabled"; |
310 } | 310 } |
311 | 311 |
312 typedef blink::protocol::CSS::Backend::EnableCallback EnableCallback; | 312 typedef blink::protocol::CSS::Backend::EnableCallback EnableCallback; |
313 | 313 |
314 enum ForcePseudoClassFlags { | 314 enum ForcePseudoClassFlags { |
315 kPseudoNone = 0, | 315 kPseudoNone = 0, |
316 kPseudoHover = 1 << 0, | 316 kPseudoHover = 1 << 0, |
317 kPseudoFocus = 1 << 1, | 317 kPseudoFocus = 1 << 1, |
318 kPseudoActive = 1 << 2, | 318 kPseudoActive = 1 << 2, |
319 kPseudoVisited = 1 << 3 | 319 kPseudoVisited = 1 << 3, |
| 320 kPseudoFocusWithin = 1 << 4 |
320 }; | 321 }; |
321 | 322 |
322 static unsigned ComputePseudoClassMask( | 323 static unsigned ComputePseudoClassMask( |
323 std::unique_ptr<protocol::Array<String>> pseudo_class_array) { | 324 std::unique_ptr<protocol::Array<String>> pseudo_class_array) { |
324 DEFINE_STATIC_LOCAL(String, active, ("active")); | 325 DEFINE_STATIC_LOCAL(String, active, ("active")); |
325 DEFINE_STATIC_LOCAL(String, hover, ("hover")); | 326 DEFINE_STATIC_LOCAL(String, hover, ("hover")); |
326 DEFINE_STATIC_LOCAL(String, focus, ("focus")); | 327 DEFINE_STATIC_LOCAL(String, focus, ("focus")); |
| 328 DEFINE_STATIC_LOCAL(String, focusWithin, ("focus-within")); |
327 DEFINE_STATIC_LOCAL(String, visited, ("visited")); | 329 DEFINE_STATIC_LOCAL(String, visited, ("visited")); |
328 if (!pseudo_class_array || !pseudo_class_array->length()) | 330 if (!pseudo_class_array || !pseudo_class_array->length()) |
329 return kPseudoNone; | 331 return kPseudoNone; |
330 | 332 |
331 unsigned result = kPseudoNone; | 333 unsigned result = kPseudoNone; |
332 for (size_t i = 0; i < pseudo_class_array->length(); ++i) { | 334 for (size_t i = 0; i < pseudo_class_array->length(); ++i) { |
333 String pseudo_class = pseudo_class_array->get(i); | 335 String pseudo_class = pseudo_class_array->get(i); |
334 if (pseudo_class == active) | 336 if (pseudo_class == active) |
335 result |= kPseudoActive; | 337 result |= kPseudoActive; |
336 else if (pseudo_class == hover) | 338 else if (pseudo_class == hover) |
337 result |= kPseudoHover; | 339 result |= kPseudoHover; |
338 else if (pseudo_class == focus) | 340 else if (pseudo_class == focus) |
339 result |= kPseudoFocus; | 341 result |= kPseudoFocus; |
| 342 else if (pseudo_class == focusWithin) |
| 343 result |= kPseudoFocusWithin; |
340 else if (pseudo_class == visited) | 344 else if (pseudo_class == visited) |
341 result |= kPseudoVisited; | 345 result |= kPseudoVisited; |
342 } | 346 } |
343 | 347 |
344 return result; | 348 return result; |
345 } | 349 } |
346 | 350 |
347 class InspectorCSSAgent::StyleSheetAction : public InspectorHistory::Action { | 351 class InspectorCSSAgent::StyleSheetAction : public InspectorHistory::Action { |
348 WTF_MAKE_NONCOPYABLE(StyleSheetAction); | 352 WTF_MAKE_NONCOPYABLE(StyleSheetAction); |
349 | 353 |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 | 862 |
859 bool force = false; | 863 bool force = false; |
860 unsigned forced_pseudo_state = it->value; | 864 unsigned forced_pseudo_state = it->value; |
861 switch (pseudo_type) { | 865 switch (pseudo_type) { |
862 case CSSSelector::kPseudoActive: | 866 case CSSSelector::kPseudoActive: |
863 force = forced_pseudo_state & kPseudoActive; | 867 force = forced_pseudo_state & kPseudoActive; |
864 break; | 868 break; |
865 case CSSSelector::kPseudoFocus: | 869 case CSSSelector::kPseudoFocus: |
866 force = forced_pseudo_state & kPseudoFocus; | 870 force = forced_pseudo_state & kPseudoFocus; |
867 break; | 871 break; |
| 872 case CSSSelector::kPseudoFocusWithin: |
| 873 force = forced_pseudo_state & kPseudoFocusWithin; |
| 874 break; |
868 case CSSSelector::kPseudoHover: | 875 case CSSSelector::kPseudoHover: |
869 force = forced_pseudo_state & kPseudoHover; | 876 force = forced_pseudo_state & kPseudoHover; |
870 break; | 877 break; |
871 case CSSSelector::kPseudoVisited: | 878 case CSSSelector::kPseudoVisited: |
872 force = forced_pseudo_state & kPseudoVisited; | 879 force = forced_pseudo_state & kPseudoVisited; |
873 break; | 880 break; |
874 default: | 881 default: |
875 break; | 882 break; |
876 } | 883 } |
877 if (force) | 884 if (force) |
(...skipping 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2527 visitor->Trace(css_style_sheet_to_inspector_style_sheet_); | 2534 visitor->Trace(css_style_sheet_to_inspector_style_sheet_); |
2528 visitor->Trace(document_to_css_style_sheets_); | 2535 visitor->Trace(document_to_css_style_sheets_); |
2529 visitor->Trace(invalidated_documents_); | 2536 visitor->Trace(invalidated_documents_); |
2530 visitor->Trace(node_to_inspector_style_sheet_); | 2537 visitor->Trace(node_to_inspector_style_sheet_); |
2531 visitor->Trace(inspector_user_agent_style_sheet_); | 2538 visitor->Trace(inspector_user_agent_style_sheet_); |
2532 visitor->Trace(tracker_); | 2539 visitor->Trace(tracker_); |
2533 InspectorBaseAgent::Trace(visitor); | 2540 InspectorBaseAgent::Trace(visitor); |
2534 } | 2541 } |
2535 | 2542 |
2536 } // namespace blink | 2543 } // namespace blink |
OLD | NEW |