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

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 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 661
662 void Internals::selectColorInColorChooser(Element* element, const String& colorV alue) 662 void Internals::selectColorInColorChooser(Element* element, const String& colorV alue)
663 { 663 {
664 if (!element->hasTagName(inputTag)) 664 if (!element->hasTagName(inputTag))
665 return; 665 return;
666 toHTMLInputElement(element)->selectColorInColorChooser(Color(colorValue)); 666 toHTMLInputElement(element)->selectColorInColorChooser(Color(colorValue));
667 } 667 }
668 668
669 Vector<String> Internals::formControlStateOfPreviousHistoryItem(ExceptionState& es) 669 Vector<String> Internals::formControlStateOfPreviousHistoryItem(ExceptionState& es)
670 { 670 {
671 HistoryItem* mainItem = frame()->loader().history()->previousItem(); 671 HistoryItem* mainItem = frame()->page()->history()->previousItem(frame());
672 if (!mainItem) { 672 if (!mainItem) {
673 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 673 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
674 return Vector<String>(); 674 return Vector<String>();
675 } 675 }
676 String uniqueName = frame()->tree().uniqueName(); 676 return mainItem->documentState();
677 if (mainItem->target() != uniqueName && !mainItem->childItemWithTarget(uniqu eName)) {
678 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
679 return Vector<String>();
680 }
681 return mainItem->target() == uniqueName ? mainItem->documentState() : mainIt em->childItemWithTarget(uniqueName)->documentState();
682 } 677 }
683 678
684 void Internals::setFormControlStateOfPreviousHistoryItem(const Vector<String>& s tate, ExceptionState& es) 679 void Internals::setFormControlStateOfPreviousHistoryItem(const Vector<String>& s tate, ExceptionState& es)
685 { 680 {
686 HistoryItem* mainItem = frame()->loader().history()->previousItem(); 681 HistoryItem* mainItem = frame()->page()->history()->previousItem(frame());
687 if (!mainItem) { 682 if (!mainItem) {
688 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 683 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
689 return; 684 return;
690 } 685 }
691 String uniqueName = frame()->tree().uniqueName(); 686 mainItem->setDocumentState(state);
692 if (mainItem->target() == uniqueName)
693 mainItem->setDocumentState(state);
694 else if (HistoryItem* subItem = mainItem->childItemWithTarget(uniqueName))
695 subItem->setDocumentState(state);
696 else
697 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
698 } 687 }
699 688
700 void Internals::setEnableMockPagePopup(bool enabled, ExceptionState& es) 689 void Internals::setEnableMockPagePopup(bool enabled, ExceptionState& es)
701 { 690 {
702 Document* document = contextDocument(); 691 Document* document = contextDocument();
703 if (!document || !document->page()) 692 if (!document || !document->page())
704 return; 693 return;
705 Page* page = document->page(); 694 Page* page = document->page();
706 if (!enabled) { 695 if (!enabled) {
707 page->chrome().client().resetPagePopupDriver(); 696 page->chrome().client().resetPagePopupDriver();
(...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after
2029 return MallocStatistics::create(); 2018 return MallocStatistics::create();
2030 } 2019 }
2031 2020
2032 PassRefPtr<TypeConversions> Internals::typeConversions() const 2021 PassRefPtr<TypeConversions> Internals::typeConversions() const
2033 { 2022 {
2034 return TypeConversions::create(); 2023 return TypeConversions::create();
2035 } 2024 }
2036 2025
2037 Vector<String> Internals::getReferencedFilePaths() const 2026 Vector<String> Internals::getReferencedFilePaths() const
2038 { 2027 {
2039 frame()->loader().history()->saveDocumentAndScrollState(); 2028 frame()->page()->history()->saveDocumentAndScrollState(frame());
2040 return FormController::getReferencedFilePaths(frame()->loader().history()->c urrentItem()->documentState()); 2029 return FormController::getReferencedFilePaths(frame()->page()->history()->cu rrentItem(frame())->documentState());
2041 } 2030 }
2042 2031
2043 void Internals::startTrackingRepaints(Document* document, ExceptionState& es) 2032 void Internals::startTrackingRepaints(Document* document, ExceptionState& es)
2044 { 2033 {
2045 if (!document || !document->view()) { 2034 if (!document || !document->view()) {
2046 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 2035 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
2047 return; 2036 return;
2048 } 2037 }
2049 2038
2050 FrameView* frameView = document->view(); 2039 FrameView* frameView = document->view();
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
2270 } 2259 }
2271 2260
2272 document->updateLayout(); 2261 document->updateLayout();
2273 2262
2274 RenderView* view = document->renderView(); 2263 RenderView* view = document->renderView();
2275 if (view->compositor()) 2264 if (view->compositor())
2276 view->compositor()->updateCompositingLayers(CompositingUpdateFinishAllDe ferredWork); 2265 view->compositor()->updateCompositingLayers(CompositingUpdateFinishAllDe ferredWork);
2277 } 2266 }
2278 2267
2279 } 2268 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698