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

Side by Side Diff: Source/core/testing/Internals.cpp

Issue 28983004: Split the frame tree logic out of HistoryItem (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
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 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 toHTMLInputElement(element)->selectColorInColorChooser(Color(colorValue)); 720 toHTMLInputElement(element)->selectColorInColorChooser(Color(colorValue));
721 } 721 }
722 722
723 Vector<String> Internals::formControlStateOfPreviousHistoryItem(ExceptionState& es) 723 Vector<String> Internals::formControlStateOfPreviousHistoryItem(ExceptionState& es)
724 { 724 {
725 HistoryItem* mainItem = frame()->loader()->history()->previousItem(); 725 HistoryItem* mainItem = frame()->loader()->history()->previousItem();
726 if (!mainItem) { 726 if (!mainItem) {
727 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 727 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
728 return Vector<String>(); 728 return Vector<String>();
729 } 729 }
730 String uniqueName = frame()->tree()->uniqueName(); 730 if (!frame()->loader()->history()->currentItem(frame())) {
731 if (mainItem->target() != uniqueName && !mainItem->childItemWithTarget(uniqu eName)) {
732 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 731 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
733 return Vector<String>(); 732 return Vector<String>();
734 } 733 }
735 return mainItem->target() == uniqueName ? mainItem->documentState() : mainIt em->childItemWithTarget(uniqueName)->documentState(); 734 return frame()->loader()->history()->currentItem(frame())->documentState();
736 } 735 }
737 736
738 void Internals::setFormControlStateOfPreviousHistoryItem(const Vector<String>& s tate, ExceptionState& es) 737 void Internals::setFormControlStateOfPreviousHistoryItem(const Vector<String>& s tate, ExceptionState& es)
739 { 738 {
740 HistoryItem* mainItem = frame()->loader()->history()->previousItem(); 739 HistoryItem* mainItem = frame()->loader()->history()->previousItem();
741 if (!mainItem) { 740 if (!mainItem) {
742 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 741 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
743 return; 742 return;
744 } 743 }
745 String uniqueName = frame()->tree()->uniqueName(); 744 if (HistoryItem* item = frame()->loader()->history()->currentItem(frame()))
746 if (mainItem->target() == uniqueName) 745 item->setDocumentState(state);
747 mainItem->setDocumentState(state);
748 else if (HistoryItem* subItem = mainItem->childItemWithTarget(uniqueName))
749 subItem->setDocumentState(state);
750 else 746 else
751 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 747 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
752 } 748 }
753 749
754 void Internals::enableMockSpeechSynthesizer() 750 void Internals::enableMockSpeechSynthesizer()
755 { 751 {
756 Document* document = contextDocument(); 752 Document* document = contextDocument();
757 if (!document || !document->domWindow()) 753 if (!document || !document->domWindow())
758 return; 754 return;
759 SpeechSynthesis* synthesis = DOMWindowSpeechSynthesis::speechSynthesis(docum ent->domWindow()); 755 SpeechSynthesis* synthesis = DOMWindowSpeechSynthesis::speechSynthesis(docum ent->domWindow());
(...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after
2058 return MallocStatistics::create(); 2054 return MallocStatistics::create();
2059 } 2055 }
2060 2056
2061 PassRefPtr<TypeConversions> Internals::typeConversions() const 2057 PassRefPtr<TypeConversions> Internals::typeConversions() const
2062 { 2058 {
2063 return TypeConversions::create(); 2059 return TypeConversions::create();
2064 } 2060 }
2065 2061
2066 Vector<String> Internals::getReferencedFilePaths() const 2062 Vector<String> Internals::getReferencedFilePaths() const
2067 { 2063 {
2068 frame()->loader()->history()->saveDocumentAndScrollState(); 2064 frame()->loader()->history()->saveDocumentAndScrollState(frame());
2069 return FormController::getReferencedFilePaths(frame()->loader()->history()-> currentItem()->documentState()); 2065 return FormController::getReferencedFilePaths(frame()->loader()->history()-> currentItem(frame())->documentState());
2070 } 2066 }
2071 2067
2072 void Internals::startTrackingRepaints(Document* document, ExceptionState& es) 2068 void Internals::startTrackingRepaints(Document* document, ExceptionState& es)
2073 { 2069 {
2074 if (!document || !document->view()) { 2070 if (!document || !document->view()) {
2075 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 2071 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
2076 return; 2072 return;
2077 } 2073 }
2078 2074
2079 FrameView* frameView = document->view(); 2075 FrameView* frameView = document->view();
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
2285 return false; 2281 return false;
2286 sharedContext->extensions()->loseContextCHROMIUM(Extensions3D::GUILTY_CONTEX T_RESET_ARB, Extensions3D::INNOCENT_CONTEXT_RESET_ARB); 2282 sharedContext->extensions()->loseContextCHROMIUM(Extensions3D::GUILTY_CONTEX T_RESET_ARB, Extensions3D::INNOCENT_CONTEXT_RESET_ARB);
2287 // To prevent tests that call loseSharedGraphicsContext3D from being 2283 // To prevent tests that call loseSharedGraphicsContext3D from being
2288 // flaky, we call finish so that the context is guaranteed to be lost 2284 // flaky, we call finish so that the context is guaranteed to be lost
2289 // synchronously (i.e. before returning). 2285 // synchronously (i.e. before returning).
2290 sharedContext->finish(); 2286 sharedContext->finish();
2291 return true; 2287 return true;
2292 } 2288 }
2293 2289
2294 } 2290 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698