本文整理汇总了C++中Page类的典型用法代码示例。如果您正苦于以下问题:C++ Page类的具体用法?C++ Page怎么用?C++ Page使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Page类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deferrer
Page* ChromeClientBlackBerry::createWindow(Frame*, const FrameLoadRequest& request, const WindowFeatures& features)
{
PageGroupLoadDeferrer deferrer(m_webPage->d->m_page, true);
TimerBase::fireTimersInNestedEventLoop();
int x = features.xSet ? features.x : 0;
int y = features.ySet ? features.y : 0;
int width = features.widthSet? features.width : -1;
int height = features.heightSet ? features.height : -1;
unsigned flags = 0;
if (features.menuBarVisible)
flags |= Olympia::WebKit::WebPageClient::FlagWindowHasMenuBar;
if (features.statusBarVisible)
flags |= Olympia::WebKit::WebPageClient::FlagWindowHasStatusBar;
if (features.toolBarVisible)
flags |= Olympia::WebKit::WebPageClient::FlagWindowHasToolBar;
if (features.locationBarVisible)
flags |= Olympia::WebKit::WebPageClient::FlagWindowHasLocationBar;
if (features.scrollbarsVisible)
flags |= Olympia::WebKit::WebPageClient::FlagWindowHasScrollBar;
if (features.resizable)
flags |= Olympia::WebKit::WebPageClient::FlagWindowIsResizable;
if (features.fullscreen)
flags |= Olympia::WebKit::WebPageClient::FlagWindowIsFullScreen;
if (features.dialog)
flags |= Olympia::WebKit::WebPageClient::FlagWindowIsDialog;
Olympia::WebKit::WebPage* webPage = m_webPage->client()->createWindow(x, y, width, height, flags);
if (!webPage)
return 0;
Page* newPage = webPage->d->m_page;
if (!request.resourceRequest().isNull())
newPage->mainFrame()->loader()->load(request.resourceRequest(), false);
return newPage;
}
示例2: layoutMode
QImage Score::createThumbnail()
{
LayoutMode mode = layoutMode();
setLayoutMode(LayoutMode::PAGE);
doLayout();
Page* page = pages().at(0);
QRectF fr = page->abbox();
qreal mag = 256.0 / qMax(fr.width(), fr.height());
int w = int(fr.width() * mag);
int h = int(fr.height() * mag);
QImage pm(w, h, QImage::Format_ARGB32_Premultiplied);
int dpm = lrint(DPMM * 1000.0);
pm.setDotsPerMeterX(dpm);
pm.setDotsPerMeterY(dpm);
pm.fill(0xffffffff);
double pr = MScore::pixelRatio;
MScore::pixelRatio = 1.0;
QPainter p(&pm);
p.setRenderHint(QPainter::Antialiasing, true);
p.setRenderHint(QPainter::TextAntialiasing, true);
p.scale(mag, mag);
print(&p, 0);
p.end();
MScore::pixelRatio = pr;
if (layoutMode() != mode) {
setLayoutMode(mode);
doLayout();
}
return pm;
}
示例3: LLOG
Heap::Page *Heap::WorkPage(int k) // get a new workpage with empty blocks
{
LLOG("AllocK - next work not available " << k << " empty: " << (void *)empty[k]);
Page *page = empty[k]; // hot empty page of the same klass
empty[k] = NULL;
if(!page) { // try to reacquire pages freed remotely
LLOG("AllocK - trying FreeRemote");
SmallFreeRemote();
if(work[k]->freelist) { // partially free page found
LLOG("AllocK - work available after FreeRemote " << k);
return work[k];
}
page = empty[k]; // hot empty page
empty[k] = NULL;
}
if(!page)
for(int i = 0; i < NKLASS; i++) // Try hot empty page of different klass
if(empty[i]) {
LLOG("AllocK - free page available for reformatting " << k);
page = empty[i];
empty[i] = NULL;
page->Format(k); // reformat the page for the required klass
break;
}
if(!page) { // Attempt to find page in global storage of free pages
Mutex::Lock __(mutex);
aux.SmallFreeRemoteRaw();
if(aux.work[k]->next != aux.work[k]) { // Try page of the same klass first
page = aux.work[k]->next;
page->Unlink();
LLOG("AllocK - adopting aux page " << k << " page: " << (void *)page << ", free " << (void *)page->freelist);
}
if(!page && aux.empty[k]) { // Try hot empty page of the same klass
page = aux.empty[k];
aux.empty[k] = page->next;
LLOG("AllocK - empty aux page available of the same format " << k << " page: " << (void *)page << ", free " << (void *)page->freelist);
}
if(!page)
for(int i = 0; i < NKLASS; i++) // Finally try to to find hot page of different klass
if(aux.empty[i]) {
page = aux.empty[i];
aux.empty[i] = page->next;
page->Format(k);
LLOG("AllocK - empty aux page available for reformatting " << k << " page: " << (void *)page << ", free " << (void *)page->freelist);
break;
}
if(!page) { // No free memory was found, ask system for the new page
page = (Page *)AllocRaw4KB(Ksz(k));
LLOG("AllocK - allocated new system page " << (void *)page << " " << k);
page->Format(k);
}
page->heap = this;
}
page->Link(work[k]);
ASSERT(page->klass == k);
return page;
}
示例4: updateInjectedStyleSheetCache
void DocumentStyleSheetCollection::updateInjectedStyleSheetCache() const
{
if (m_injectedStyleSheetCacheValid)
return;
m_injectedStyleSheetCacheValid = true;
m_injectedUserStyleSheets.clear();
m_injectedAuthorStyleSheets.clear();
Page* owningPage = m_document->page();
if (!owningPage)
return;
const PageGroup& pageGroup = owningPage->group();
const UserStyleSheetMap* sheetsMap = pageGroup.userStyleSheets();
if (!sheetsMap)
return;
UserStyleSheetMap::const_iterator end = sheetsMap->end();
for (UserStyleSheetMap::const_iterator it = sheetsMap->begin(); it != end; ++it) {
const UserStyleSheetVector* sheets = it->value.get();
for (unsigned i = 0; i < sheets->size(); ++i) {
const UserStyleSheet* sheet = sheets->at(i).get();
if (sheet->injectedFrames() == InjectInTopFrameOnly && m_document->ownerElement())
continue;
if (!UserContentURLPattern::matchesPatterns(m_document->url(), sheet->whitelist(), sheet->blacklist()))
continue;
RefPtr<CSSStyleSheet> groupSheet = CSSStyleSheet::createInline(const_cast<Document*>(m_document), sheet->url());
bool isUserStyleSheet = sheet->level() == UserStyleUserLevel;
if (isUserStyleSheet)
m_injectedUserStyleSheets.append(groupSheet);
else
m_injectedAuthorStyleSheets.append(groupSheet);
groupSheet->contents()->setIsUserStyleSheet(isUserStyleSheet);
groupSheet->contents()->parseString(sheet->source());
}
}
}
示例5: addpage
void File::addpage(Page &page,long pageno)
{
int freespace = 0;
int record_num = 0;
if(pageno >= page_num_ ){
for(long i = page_num_; i < pageno; ++i){
fseek(fp_,(i+1)*page_size_ + 2*sizeof(long) - 2*sizeof(int),SEEK_SET);
fwrite(&record_num,sizeof(int),1,fp_);
fwrite(&freespace,sizeof(int),1,fp_);
}
page_num_ = pageno + 1;
}
char *bits = new (std::nothrow) char[page_size_];
if(bits == NULL){
fprintf(stderr,"no enough memory!\n");
exit(-1);
}
memset(bits,0,page_size_);
page.set_page_size(page_size_);
page.tobinary(bits);
fseek(fp_,0,SEEK_SET);
fwrite(&page_num_,sizeof(long),1,fp_);
fwrite(&page_size_,sizeof(long),1,fp_);
fseek(fp_,pageno*page_size_+2*sizeof(long),SEEK_SET);
fwrite(bits,sizeof(char),page_size_,fp_);
delete [] bits;
}
示例6: getRandomRecord
const Status HeapFileScan::getRandomRecord(const RID & rid,
Record & rec)
{
// Solution Starts
Page* page;
Status status;
if ((curPageNo > 0) &&
(rid.pageNo != curPageNo))
{
// there is a page pinned which is not the desired page, unpin it
status = bufMgr->unPinPage(file, curPageNo,
dirtyFlag);
if (status != OK) return status;
curPageNo = -1;
curPage = NULL;
}
if (curPageNo < 1) { // no current page?
// get prepared to read the desired page
curPageNo = rid.pageNo; // extract page # from rid
dirtyFlag = false;
// read desired page
status = bufMgr->readPage(file, curPageNo,
curPage);
if (status != OK) return status;
}
page = curPage;
status = page->getRecord(rid, rec);
curRec.pageNo = rid.pageNo;
curRec.slotNo = rid.slotNo;
return status;
// Solution Ends
}
示例7: adoptPtr
const Vector<RefPtr<CSSStyleSheet> >* DocumentStyleSheetCollection::pageGroupUserSheets() const
{
if (m_pageGroupUserSheetCacheValid)
return m_pageGroupUserSheets.get();
m_pageGroupUserSheetCacheValid = true;
Page* owningPage = m_document->page();
if (!owningPage)
return 0;
const PageGroup& pageGroup = owningPage->group();
const UserStyleSheetMap* sheetsMap = pageGroup.userStyleSheets();
if (!sheetsMap)
return 0;
UserStyleSheetMap::const_iterator end = sheetsMap->end();
for (UserStyleSheetMap::const_iterator it = sheetsMap->begin(); it != end; ++it) {
const UserStyleSheetVector* sheets = it->second.get();
for (unsigned i = 0; i < sheets->size(); ++i) {
const UserStyleSheet* sheet = sheets->at(i).get();
if (sheet->injectedFrames() == InjectInTopFrameOnly && m_document->ownerElement())
continue;
if (!UserContentURLPattern::matchesPatterns(m_document->url(), sheet->whitelist(), sheet->blacklist()))
continue;
RefPtr<CSSStyleSheet> groupSheet = CSSStyleSheet::createInline(const_cast<Document*>(m_document), sheet->url());
if (!m_pageGroupUserSheets)
m_pageGroupUserSheets = adoptPtr(new Vector<RefPtr<CSSStyleSheet> >);
m_pageGroupUserSheets->append(groupSheet);
groupSheet->contents()->setIsUserStyleSheet(sheet->level() == UserStyleUserLevel);
groupSheet->contents()->parseString(sheet->source());
}
}
return m_pageGroupUserSheets.get();
}
示例8: mediaElement
void RenderVideo::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
MediaPlayer* mediaPlayer = mediaElement()->player();
bool displayingPoster = videoElement()->shouldDisplayPosterImage();
Page* page = 0;
if (Frame* frame = this->frame())
page = frame->page();
if (!displayingPoster) {
if (!mediaPlayer) {
if (page && paintInfo.phase == PaintPhaseForeground)
page->addRelevantUnpaintedObject(this, visualOverflowRect());
return;
}
updatePlayer();
}
LayoutRect rect = videoBox();
if (rect.isEmpty()) {
if (page && paintInfo.phase == PaintPhaseForeground)
page->addRelevantUnpaintedObject(this, visualOverflowRect());
return;
}
rect.moveBy(paintOffset);
if (page && paintInfo.phase == PaintPhaseForeground)
page->addRelevantRepaintedObject(this, rect);
if (displayingPoster)
paintIntoRect(paintInfo.context, rect);
else if (document()->view() && document()->view()->paintBehavior() & PaintBehaviorFlattenCompositingLayers)
mediaPlayer->paintCurrentFrameInContext(paintInfo.context, pixelSnappedIntRect(rect));
else
mediaPlayer->paint(paintInfo.context, pixelSnappedIntRect(rect));
}
示例9: ENABLE
void Console::profileEnd(const JSC::UString& title, ScriptCallStack* callStack)
{
Page* page = this->page();
if (!page)
return;
#if ENABLE(INSPECTOR)
if (!page->inspectorController()->profilerEnabled())
return;
#endif
RefPtr<JSC::Profile> profile = JSC::Profiler::profiler()->stopProfiling(callStack->state(), title);
if (!profile)
return;
m_profiles.append(profile);
#if ENABLE(INSPECTOR)
if (Page* page = this->page()) {
const ScriptCallFrame& lastCaller = callStack->at(0);
page->inspectorController()->addProfile(profile, lastCaller.lineNumber(), lastCaller.sourceURL());
}
#endif
}
示例10: ASSERT
void WindowProxy::setDOMWindow(AbstractDOMWindow* newDOMWindow)
{
ASSERT(newDOMWindow);
if (m_jsWindowProxies.isEmpty())
return;
ASSERT(m_frame);
JSLockHolder lock(commonVM());
for (auto& windowProxy : jsWindowProxiesAsVector()) {
if (&windowProxy->wrapped() == newDOMWindow)
continue;
windowProxy->setWindow(*newDOMWindow);
ScriptController* scriptController = nullptr;
Page* page = nullptr;
if (is<Frame>(*m_frame)) {
auto& frame = downcast<Frame>(*m_frame);
scriptController = &frame.script();
page = frame.page();
}
// ScriptController's m_cacheableBindingRootObject persists between page navigations
// so needs to know about the new JSDOMWindow.
if (auto* cacheableBindingRootObject = scriptController ? scriptController->existingCacheableBindingRootObject() : nullptr)
cacheableBindingRootObject->updateGlobalObject(windowProxy->window());
windowProxy->attachDebugger(page ? page->debugger() : nullptr);
if (page)
windowProxy->window()->setProfileGroup(page->group().identifier());
windowProxy->window()->setConsoleClient(page ? &page->console() : nullptr);
}
}
示例11: dbgassert
Operator::GetNextResultT ConsumeOp::getNext(unsigned short threadid)
{
CtInt val = 0;
dbgassert(vec.at(threadid) != NULL);
Page* out = vec[threadid];
GetNextResultT result;
assertaddresslocal(&val);
const int tupw = nextOp->getOutSchema().getTupleSize();
do {
result = nextOp->getNext(threadid);
dbgassert(result.first != Error);
Page* in = result.second;
Page::Iterator it = in->createIterator();
void* tuple;
while ( (tuple = it.next()) )
{
CtInt* casttuple = (CtInt*) tuple;
for (int i=0; i<(tupw/4); ++i)
{
val ^= casttuple[i];
}
}
} while(result.first == Operator::Ready);
assertaddresslocal(&val);
void* dest = out->allocateTuple();
schema.writeData(dest, 0, &val);
return make_pair(Finished, out);
}
示例12: valueToStringWithUndefinedOrNullCheck
void Console::timeEnd(ExecState* exec, const ArgList& args)
{
UString title;
if (args.size() >= 1)
title = valueToStringWithUndefinedOrNullCheck(exec, args.at(exec, 0));
if (title.isNull())
return;
Page* page = this->page();
if (!page)
return;
double elapsed;
if (!page->inspectorController()->stopTiming(title, elapsed))
return;
String message = String(title) + String::format(": %.0fms", elapsed);
KURL url;
unsigned lineNumber;
retrieveLastCaller(exec, url, lineNumber);
page->inspectorController()->addMessageToConsole(JSMessageSource, LogMessageLevel, message, lineNumber, url.string());
}
示例13: BookDevice
bool Shelfscreen::readBook(QString book)
{
for (int loopc=0; loopc<elements.size(); loopc++)
{
ShelfElement & se = elements[loopc];
if(se.book->getFullName() == book)
{
se.book->open();
settings->setCurrentBook(se.book->getFullName());
settings->setCurrentPage(0);
BookDevice * bd = new BookDevice(se.book);
bd->open(QIODevice::ReadOnly);
Parser * parser = new Parser(bd, se.book);
Page * page = new Page(se.book, parser);
top_level->addWidget(page);
page->setPage(0);
top_level->setCurrentWidget(page);
current_page = page;
return true;
}
}
return false;
}
示例14: getpage
int File::getpage(Page &page,long pageno)
{
if(pageno >= page_num_){
fprintf(stderr,"you tried to read past the end of the file\n");
return -1;
}
char *bits = new (std::nothrow) char[page_size_];
if(bits == NULL){
fprintf(stderr,"no enough memory!\n");
exit(-1);
}
fseek(fp_,pageno*page_size_+2*sizeof(long),SEEK_SET);
fread(bits,sizeof(char),page_size_,fp_);
page.set_page_size(page_size_);
page.frombinary(bits);
delete [] bits;
return 0;
}
示例15: addMessage
void Console::addMessage(MessageType type, MessageLevel level, PassRefPtr<ScriptArguments> prpArguments, PassRefPtr<ScriptCallStack> prpCallStack, bool acceptNoArguments)
{
RefPtr<ScriptArguments> arguments = prpArguments;
RefPtr<ScriptCallStack> callStack = prpCallStack;
Page* page = this->page();
if (!page)
return;
const ScriptCallFrame& lastCaller = callStack->at(0);
if (!acceptNoArguments && !arguments->argumentCount())
return;
if (Console::shouldPrintExceptions()) {
printSourceURLAndLine(lastCaller.sourceURL(), 0);
printMessageSourceAndLevelPrefix(JSMessageSource, level);
for (unsigned i = 0; i < arguments->argumentCount(); ++i) {
String argAsString;
if (arguments->argumentAt(i).getString(arguments->globalState(), argAsString))
printf(" %s", argAsString.utf8().data());
}
printf("\n");
}
String message;
for (unsigned i = 0; i < arguments->argumentCount(); ++i) {
message.append(arguments->argumentAt(i).toString(arguments->globalState()));
if (i < arguments->argumentCount() - 1)
message.append(' ');
}
page->chrome()->client()->addMessageToConsole(JSMessageSource, type, level, message, lastCaller.lineNumber(), lastCaller.sourceURL(), prpCallStack);
InspectorInstrumentation::addMessageToConsole(page, JSMessageSource, type, level, message, arguments, callStack);
}