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

Side by Side Diff: Source/core/inspector/InspectorCSSAgent.cpp

Issue 339133002: DevTools: Fix test inspector-protocol/stylesheet-tracking-restart.html flakiness (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 | « LayoutTests/TestExpectations ('k') | no next file » | 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) 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 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 bool isInitialFrontendLoad = styleSheetsUpdateType == InitialFrontendLoad; 510 bool isInitialFrontendLoad = styleSheetsUpdateType == InitialFrontendLoad;
511 511
512 HashSet<CSSStyleSheet*>* documentCSSStyleSheets = m_documentToCSSStyleSheets .get(document); 512 HashSet<CSSStyleSheet*>* documentCSSStyleSheets = m_documentToCSSStyleSheets .get(document);
513 if (!documentCSSStyleSheets) { 513 if (!documentCSSStyleSheets) {
514 documentCSSStyleSheets = new HashSet<CSSStyleSheet*>(); 514 documentCSSStyleSheets = new HashSet<CSSStyleSheet*>();
515 OwnPtr<HashSet<CSSStyleSheet*> > documentCSSStyleSheetsPtr = adoptPtr(do cumentCSSStyleSheets); 515 OwnPtr<HashSet<CSSStyleSheet*> > documentCSSStyleSheetsPtr = adoptPtr(do cumentCSSStyleSheets);
516 m_documentToCSSStyleSheets.set(document, documentCSSStyleSheetsPtr.relea se()); 516 m_documentToCSSStyleSheets.set(document, documentCSSStyleSheetsPtr.relea se());
517 } 517 }
518 518
519 HashSet<CSSStyleSheet*> removedSheets(*documentCSSStyleSheets); 519 HashSet<CSSStyleSheet*> removedSheets(*documentCSSStyleSheets);
520 520 Vector<CSSStyleSheet*> addedSheets;
521 HashSet<CSSStyleSheet*> addedSheets;
522 for (Vector<CSSStyleSheet*>::const_iterator it = allSheetsVector.begin(); it != allSheetsVector.end(); ++it) { 521 for (Vector<CSSStyleSheet*>::const_iterator it = allSheetsVector.begin(); it != allSheetsVector.end(); ++it) {
523 CSSStyleSheet* cssStyleSheet = *it; 522 CSSStyleSheet* cssStyleSheet = *it;
524 if (removedSheets.contains(cssStyleSheet)) { 523 if (removedSheets.contains(cssStyleSheet)) {
525 removedSheets.remove(cssStyleSheet); 524 removedSheets.remove(cssStyleSheet);
526 if (isInitialFrontendLoad) 525 if (isInitialFrontendLoad)
527 addedSheets.add(cssStyleSheet); 526 addedSheets.append(cssStyleSheet);
528 } else { 527 } else {
529 addedSheets.add(cssStyleSheet); 528 addedSheets.append(cssStyleSheet);
530 } 529 }
531 } 530 }
532 531
533 for (HashSet<CSSStyleSheet*>::iterator it = removedSheets.begin(); it != rem ovedSheets.end(); ++it) { 532 for (HashSet<CSSStyleSheet*>::iterator it = removedSheets.begin(); it != rem ovedSheets.end(); ++it) {
534 CSSStyleSheet* cssStyleSheet = *it; 533 CSSStyleSheet* cssStyleSheet = *it;
535 RefPtr<InspectorStyleSheet> inspectorStyleSheet = m_cssStyleSheetToInspe ctorStyleSheet.get(cssStyleSheet); 534 RefPtr<InspectorStyleSheet> inspectorStyleSheet = m_cssStyleSheetToInspe ctorStyleSheet.get(cssStyleSheet);
536 ASSERT(inspectorStyleSheet); 535 ASSERT(inspectorStyleSheet);
537 536
538 documentCSSStyleSheets->remove(cssStyleSheet); 537 documentCSSStyleSheets->remove(cssStyleSheet);
539 if (m_idToInspectorStyleSheet.contains(inspectorStyleSheet->id())) { 538 if (m_idToInspectorStyleSheet.contains(inspectorStyleSheet->id())) {
540 String id = unbindStyleSheet(inspectorStyleSheet.get()); 539 String id = unbindStyleSheet(inspectorStyleSheet.get());
541 if (m_frontend && !isInitialFrontendLoad) 540 if (m_frontend && !isInitialFrontendLoad)
542 m_frontend->styleSheetRemoved(id); 541 m_frontend->styleSheetRemoved(id);
543 } 542 }
544 } 543 }
545 544
546 for (HashSet<CSSStyleSheet*>::iterator it = addedSheets.begin(); it != added Sheets.end(); ++it) { 545 for (Vector<CSSStyleSheet*>::iterator it = addedSheets.begin(); it != addedS heets.end(); ++it) {
547 CSSStyleSheet* cssStyleSheet = *it; 546 CSSStyleSheet* cssStyleSheet = *it;
548 bool isNew = isInitialFrontendLoad || !m_cssStyleSheetToInspectorStyleSh eet.contains(cssStyleSheet); 547 bool isNew = isInitialFrontendLoad || !m_cssStyleSheetToInspectorStyleSh eet.contains(cssStyleSheet);
549 if (isNew) { 548 if (isNew) {
550 InspectorStyleSheet* newStyleSheet = bindStyleSheet(cssStyleSheet); 549 InspectorStyleSheet* newStyleSheet = bindStyleSheet(cssStyleSheet);
551 documentCSSStyleSheets->add(cssStyleSheet); 550 documentCSSStyleSheets->add(cssStyleSheet);
552 if (m_frontend) 551 if (m_frontend)
553 m_frontend->styleSheetAdded(newStyleSheet->buildObjectForStyleSh eetInfo()); 552 m_frontend->styleSheetAdded(newStyleSheet->buildObjectForStyleSh eetInfo());
554 } 553 }
555 } 554 }
556 555
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
1394 documentsToChange.add(element->ownerDocument()); 1393 documentsToChange.add(element->ownerDocument());
1395 } 1394 }
1396 1395
1397 m_nodeIdToForcedPseudoState.clear(); 1396 m_nodeIdToForcedPseudoState.clear();
1398 for (HashSet<Document*>::iterator it = documentsToChange.begin(), end = docu mentsToChange.end(); it != end; ++it) 1397 for (HashSet<Document*>::iterator it = documentsToChange.begin(), end = docu mentsToChange.end(); it != end; ++it)
1399 (*it)->setNeedsStyleRecalc(SubtreeStyleChange); 1398 (*it)->setNeedsStyleRecalc(SubtreeStyleChange);
1400 } 1399 }
1401 1400
1402 } // namespace WebCore 1401 } // namespace WebCore
1403 1402
OLDNEW
« no previous file with comments | « LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698