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

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, 1 month 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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 670
671 void Internals::selectColorInColorChooser(Element* element, const String& colorV alue) 671 void Internals::selectColorInColorChooser(Element* element, const String& colorV alue)
672 { 672 {
673 if (!element->hasTagName(inputTag)) 673 if (!element->hasTagName(inputTag))
674 return; 674 return;
675 toHTMLInputElement(element)->selectColorInColorChooser(Color(colorValue)); 675 toHTMLInputElement(element)->selectColorInColorChooser(Color(colorValue));
676 } 676 }
677 677
678 Vector<String> Internals::formControlStateOfPreviousHistoryItem(ExceptionState& es) 678 Vector<String> Internals::formControlStateOfPreviousHistoryItem(ExceptionState& es)
679 { 679 {
680 HistoryItem* mainItem = frame()->loader().history()->previousItem(); 680 HistoryItem* mainItem = frame()->loader().history()->previousItem(frame());
681 if (!mainItem) { 681 if (!mainItem) {
682 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 682 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
683 return Vector<String>(); 683 return Vector<String>();
684 } 684 }
685 String uniqueName = frame()->tree().uniqueName(); 685 return mainItem->documentState();
686 if (mainItem->target() != uniqueName && !mainItem->childItemWithTarget(uniqu eName)) {
687 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
688 return Vector<String>();
689 }
690 return mainItem->target() == uniqueName ? mainItem->documentState() : mainIt em->childItemWithTarget(uniqueName)->documentState();
691 } 686 }
692 687
693 void Internals::setFormControlStateOfPreviousHistoryItem(const Vector<String>& s tate, ExceptionState& es) 688 void Internals::setFormControlStateOfPreviousHistoryItem(const Vector<String>& s tate, ExceptionState& es)
694 { 689 {
695 HistoryItem* mainItem = frame()->loader().history()->previousItem(); 690 HistoryItem* mainItem = frame()->loader().history()->previousItem(frame());
696 if (!mainItem) { 691 if (!mainItem) {
697 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 692 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
698 return; 693 return;
699 } 694 }
700 String uniqueName = frame()->tree().uniqueName(); 695 mainItem->setDocumentState(state);
701 if (mainItem->target() == uniqueName)
702 mainItem->setDocumentState(state);
703 else if (HistoryItem* subItem = mainItem->childItemWithTarget(uniqueName))
704 subItem->setDocumentState(state);
705 else
706 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
707 } 696 }
708 697
709 void Internals::setEnableMockPagePopup(bool enabled, ExceptionState& es) 698 void Internals::setEnableMockPagePopup(bool enabled, ExceptionState& es)
710 { 699 {
711 Document* document = contextDocument(); 700 Document* document = contextDocument();
712 if (!document || !document->page()) 701 if (!document || !document->page())
713 return; 702 return;
714 Page* page = document->page(); 703 Page* page = document->page();
715 if (!enabled) { 704 if (!enabled) {
716 page->chrome().client().resetPagePopupDriver(); 705 page->chrome().client().resetPagePopupDriver();
(...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after
2007 return MallocStatistics::create(); 1996 return MallocStatistics::create();
2008 } 1997 }
2009 1998
2010 PassRefPtr<TypeConversions> Internals::typeConversions() const 1999 PassRefPtr<TypeConversions> Internals::typeConversions() const
2011 { 2000 {
2012 return TypeConversions::create(); 2001 return TypeConversions::create();
2013 } 2002 }
2014 2003
2015 Vector<String> Internals::getReferencedFilePaths() const 2004 Vector<String> Internals::getReferencedFilePaths() const
2016 { 2005 {
2017 frame()->loader().history()->saveDocumentAndScrollState(); 2006 frame()->loader().history()->saveDocumentAndScrollState(frame());
2018 return FormController::getReferencedFilePaths(frame()->loader().history()->c urrentItem()->documentState()); 2007 return FormController::getReferencedFilePaths(frame()->loader().history()->c urrentItem(frame())->documentState());
2019 } 2008 }
2020 2009
2021 void Internals::startTrackingRepaints(Document* document, ExceptionState& es) 2010 void Internals::startTrackingRepaints(Document* document, ExceptionState& es)
2022 { 2011 {
2023 if (!document || !document->view()) { 2012 if (!document || !document->view()) {
2024 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 2013 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
2025 return; 2014 return;
2026 } 2015 }
2027 2016
2028 FrameView* frameView = document->view(); 2017 FrameView* frameView = document->view();
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
2234 return false; 2223 return false;
2235 sharedContext->extensions()->loseContextCHROMIUM(Extensions3D::GUILTY_CONTEX T_RESET_ARB, Extensions3D::INNOCENT_CONTEXT_RESET_ARB); 2224 sharedContext->extensions()->loseContextCHROMIUM(Extensions3D::GUILTY_CONTEX T_RESET_ARB, Extensions3D::INNOCENT_CONTEXT_RESET_ARB);
2236 // To prevent tests that call loseSharedGraphicsContext3D from being 2225 // To prevent tests that call loseSharedGraphicsContext3D from being
2237 // flaky, we call finish so that the context is guaranteed to be lost 2226 // flaky, we call finish so that the context is guaranteed to be lost
2238 // synchronously (i.e. before returning). 2227 // synchronously (i.e. before returning).
2239 sharedContext->finish(); 2228 sharedContext->finish();
2240 return true; 2229 return true;
2241 } 2230 }
2242 2231
2243 } 2232 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698