bool HTMLFrameOwnerElement::loadOrRedirectSubframe(const KURL& url, const AtomicString& frameName, bool lockBackForwardList) { RefPtr<Frame> parentFrame = document().frame(); if (contentFrame()) { contentFrame()->navigationScheduler().scheduleLocationChange(document().securityOrigin(), url.string(), parentFrame->loader().outgoingReferrer(), lockBackForwardList); return true; } if (!document().securityOrigin()->canDisplay(url)) { FrameLoader::reportLocalLoadFailed(parentFrame.get(), url.string()); return false; } if (!SubframeLoadingDisabler::canLoadFrame(*this)) return false; String referrer = SecurityPolicy::generateReferrerHeader(document().referrerPolicy(), url, parentFrame->loader().outgoingReferrer()); RefPtr<Frame> childFrame = parentFrame->loader().client()->createFrame(url, frameName, referrer, this); if (!childFrame) { parentFrame->loader().checkCompleted(); return false; } // All new frames will have m_isComplete set to true at this point due to synchronously loading // an empty document in FrameLoader::init(). But many frames will now be starting an // asynchronous load of url, so we set m_isComplete to false and then check if the load is // actually completed below. (Note that we set m_isComplete to false even for synchronous // loads, so that checkCompleted() below won't bail early.) // FIXME: Can we remove this entirely? m_isComplete normally gets set to false when a load is committed. childFrame->loader().started(); RenderObject* renderObject = renderer(); FrameView* view = childFrame->view(); if (renderObject && renderObject->isWidget() && view) toRenderWidget(renderObject)->setWidget(view); // Some loads are performed synchronously (e.g., about:blank and loads // cancelled by returning a null ResourceRequest from requestFromDelegate). // In these cases, the synchronous load would have finished // before we could connect the signals, so make sure to send the // completed() signal for the child by hand and mark the load as being // complete. // FIXME: In this case the Frame will have finished loading before // it's being added to the child list. It would be a good idea to // create the child first, then invoke the loader separately. if (childFrame->loader().state() == FrameStateComplete && !childFrame->loader().policyDocumentLoader()) childFrame->loader().checkCompleted(); return true; }
// We don't use m_url, as it may not be the final URL that the object loads, // depending on <param> values. bool HTMLPlugInImageElement::allowedToLoadFrameURL(const String& url) { ASSERT(document()); ASSERT(document()->frame()); if (document()->frame()->page()->frameCount() >= Page::maxNumberOfFrames) return false; KURL completeURL = document()->completeURL(url); if (contentFrame() && protocolIsJavaScript(completeURL) && !document()->securityOrigin()->canAccess(contentDocument()->securityOrigin())) return false; // We allow one level of self-reference because some sites depend on that. // But we don't allow more than one. bool foundSelfReference = false; for (Frame* frame = document()->frame(); frame; frame = frame->tree()->parent()) { if (equalIgnoringFragmentIdentifier(frame->document()->url(), completeURL)) { if (foundSelfReference) return false; foundSelfReference = true; } } return true; }
// We don't use m_url, as it may not be the final URL that the object loads, // depending on <param> values. bool HTMLPlugInElement::allowedToLoadFrameURL(const String& url) { KURL completeURL = document().completeURL(url); if (contentFrame() && protocolIsJavaScript(completeURL) && !document().securityOrigin()->canAccess(contentDocument()->securityOrigin())) return false; return document().frame()->isURLAllowed(completeURL); }
void HTMLFrameOwnerElement::willRemove() { if (Frame* frame = contentFrame()) { frame->disconnectOwnerElement(); frame->loader()->frameDetached(); } HTMLElement::willRemove(); }
void HTMLFrameOwnerElement::disconnectContentFrame() { ASSERT(hasCustomCallbacks()); // This causes an unload event thus cannot be a part of removedFrom(). if (Frame* frame = contentFrame()) { RefPtr<Frame> protect(frame); frame->loader()->frameDetached(); frame->disconnectOwnerElement(); } }
PageMenuDialog::PageMenuDialog( Document *doc, int currentPage, QPopupMenu *popupMenu, const char *name ) : AppDialog( popupMenu, "PageMenuDialog:Caption", "BrightIdea.png", "Bright Idea", "", name, "PageMenuDialog:Button:Ok", "PageMenuDialog:Button:Cancel" ), m_listView(0), m_currentPage(currentPage), m_selectedPage(-1) { // Create a list view m_listView = new QListView( contentFrame(), "m_listView" ); Q_CHECK_PTR( m_listView ); QString page( "" ), text( "" ); translate( text, "PageMenuDialog:ListView:Col0" ); m_listView->addColumn( text ); m_listView->addColumn( "" ); translate( text, "PageMenuDialog:ListView:Col1" ); m_listView->addColumn( text ); m_listView->setColumnWidthMode( 0, QListView::Maximum ); m_listView->setColumnWidthMode( 1, QListView::Maximum ); m_listView->setColumnWidthMode( 2, QListView::Maximum ); m_listView->setMultiSelection( false ); m_listView->setRootIsDecorated( false ); m_listView->setAllColumnsShowFocus( true ); m_listView->setSorting( 0, true ); m_listView->setItemMargin( 3 ); // Add table of contents entries TocItem *tocItem; QListViewItem *lvi; QPixmap pm; int ypos = 0; for ( tocItem = doc->m_tocList->first(); tocItem != 0; tocItem = doc->m_tocList->next() ) { lvi = new QListViewItem( m_listView ); Q_CHECK_PTR( lvi ); lvi->setText( 0, QString( "%1" ).arg( tocItem->m_page, 4 ) ); lvi->setPixmap( 1, doc->m_tocList->pixmap( tocItem->m_type, pm ) ); lvi->setText( 2, tocItem->m_text ); // Show the current page if ( tocItem->m_page == m_currentPage ) { m_listView->setSelected( lvi, true ); ypos = m_listView->itemPos( lvi ); } } // Show the current selection m_listView->setContentsPos( 0, ypos ); // Allow a double click to select a single item connect( m_listView, SIGNAL( doubleClicked( QListViewItem * ) ), this, SLOT( itemDoubleClicked( QListViewItem * ) ) ); return; }
void HTMLFrameOwnerElement::disconnectContentFrame() { // FIXME: Currently we don't do this in removedFrom because this causes an // unload event in the subframe which could execute script that could then // reach up into this document and then attempt to look back down. We should // see if this behavior is really needed as Gecko does not allow this. if (Frame* frame = contentFrame()) { RefPtr<Frame> protect(frame); frame->loader().frameDetached(); frame->disconnectOwnerElement(); } }
GraphLimitsDialog::GraphLimitsDialog( BpDocument *bp, QPtrList<GraphAxleParms> *yParmsList, const char *name ) : AppDialog( bp, "GraphLimitsDialog:Caption", "BlackfootRiver.png", "Blackfoot River", "graphLimitsDialog.html", name ), m_bp(bp), m_yParmsList( yParmsList ), m_gridFrame(0), m_gridLayout(0), m_vars( 0 ) { // Initialize all widget pointers int i; for ( i=0; i<MaxGraphs; i++ ) { m_label[i] = m_range[i] = 0; m_min[i] = m_max[i] = 0; } // Hidden frame to contain a grid layout m_gridFrame = new QFrame( contentFrame(), "m_gridFrame" ); Q_CHECK_PTR( m_gridFrame ); m_gridFrame->setFrameStyle( QFrame::Raised ); // Create the label-range-entry grid layout m_gridLayout = new QGridLayout( m_gridFrame, 4, 4, 0, 2, "m_gridLayout" ) ; Q_CHECK_PTR( m_gridLayout ); // Column headers QString text(""); QLabel *lbl; for ( i=0; i<4; i++ ) { translate( text, QString( "GraphLimitsDialog:Header:%1" ).arg( i ) ); lbl = new QLabel( text, m_gridFrame ); Q_CHECK_PTR( lbl ); m_gridLayout->addWidget( lbl, 0, i, AlignCenter ); } // Add the name, range, and min and max spin boxes for each input EqVar *yVar; GraphAxleParms *yParms = m_yParmsList->first(); int row = 1; double min_val = 0.; double max_val = 100000000.; double step_val = 1.; for ( int yid = 0; yid < m_bp->tableVars() && m_vars < MaxGraphs; yid++ ) { // Get the variable pointer and make sure it is continuous yVar = m_bp->tableVar( yid ); if ( yVar->isContinuous() ) { // Variable label m_label[m_vars] = new QLabel( *(yVar->m_label), m_gridFrame ); Q_CHECK_PTR( m_label[m_vars] ); m_gridLayout->addWidget( m_label[m_vars], row, 0, AlignLeft ); // Variable range and units text = QString( "%1 - %2 %3" ) .arg( yParms->m_dataMin, 0, 'f', yVar->m_displayDecimals ) .arg( yParms->m_dataMax, 0, 'f', yVar->m_displayDecimals ) .arg( yVar->m_displayUnits ); m_range[m_vars] = new QLabel( text, m_gridFrame ); Q_CHECK_PTR( m_range[m_vars] ); m_gridLayout->addWidget( m_range[m_vars], row, 1, AlignLeft ); // Minimum Y axis value m_min[m_vars] = new RealSpinBox( min_val, max_val, step_val, yParms->m_axleMin, yVar->m_displayDecimals, m_gridFrame ); Q_CHECK_PTR( m_min[m_vars] ); m_gridLayout->addWidget( m_min[m_vars], row, 2 ); // Maximum Y axis value m_max[m_vars] = new RealSpinBox( min_val, max_val, step_val, yParms->m_axleMax, yVar->m_displayDecimals, m_gridFrame ); Q_CHECK_PTR( m_max[m_vars] ); m_gridLayout->addWidget( m_max[m_vars], row, 3 ); // Increment variable counter and return m_vars++; row++; yParms = m_yParmsList->next(); } } return; }