int RenderView::viewLogicalHeight() const { int height = style()->isHorizontalWritingMode() ? viewHeight() : viewWidth(); if (hasColumns() && !style()->hasInlineColumnAxis()) { if (int pageLength = m_frameView->pagination().pageLength) height = pageLength; } return height; }
// --------------------------------------------------------------------------- // CAknPhysicsRestrictor::CalculateViewLimits // --------------------------------------------------------------------------- // void CAknPhysicsRestrictor::CalculateViewLimits() { if ( !iProvider ) { return; } TInt viewHeight( iViewSize.iHeight ); TInt worldHeight( iWorldSize.iHeight ); TReal emptySegment( KNotRestrictedSegment ); if ( iLandscape ) { viewHeight = iViewSize.iWidth; worldHeight = iWorldSize.iWidth; } // Calculate bottom limit if ( viewHeight > worldHeight ) { emptySegment = ( TReal ) iProvider->ShortListEmptySpace() / KEmptySpaceFactor; iEmptySpaceArea = worldHeight * ( emptySegment ); iPositionBottomLimit = viewHeight / 2 + iEmptySpaceArea; } else { emptySegment = ( TReal ) iProvider->LongListEmptySpace() / KEmptySpaceFactor; iEmptySpaceArea = viewHeight * ( emptySegment ); iPositionBottomLimit = worldHeight - viewHeight / 2 + iEmptySpaceArea; } // Calculate top limit iPositionTopLimit = viewHeight / 2 - iEmptySpaceArea; // Check if empty space is really restricted if ( emptySegment == KNotRestrictedSegment ) { iEmptySpaceRestricted = EFalse; } else { iEmptySpaceRestricted = ETrue; } }
void saveGDAL(const std::string &filename, const std::string &template_name, int xoffset, int yoffset){ GDALDataset *fintempl = (GDALDataset*)GDALOpen(template_name.c_str(), GA_ReadOnly); assert(fintempl!=NULL); //TODO: Error handle GDALDriver *poDriver = GetGDALDriverManager()->GetDriverByName("GTiff"); assert(poDriver!=NULL); //TODO: Error handle GDALDataset *fout = poDriver->Create(filename.c_str(), viewWidth(), viewHeight(), 1, myGDALType(), NULL); assert(fout!=NULL); //TODO: Error handle GDALRasterBand *oband = fout->GetRasterBand(1); oband->SetNoDataValue(no_data); //The geotransform maps each grid cell to a point in an affine-transformed //projection of the actual terrain. The geostransform is specified as follows: // Xgeo = GT(0) + Xpixel*GT(1) + Yline*GT(2) // Ygeo = GT(3) + Xpixel*GT(4) + Yline*GT(5) //In case of north up images, the GT(2) and GT(4) coefficients are zero, and //the GT(1) is pixel width, and GT(5) is pixel height. The (GT(0),GT(3)) //position is the top left corner of the top left pixel of the raster. double geotrans[6]; fintempl->GetGeoTransform(geotrans); //We shift the top-left pixel of hte image eastward to the appropriate //coordinate geotrans[0] += xoffset*geotrans[1]; //We shift the top-left pixel of the image southward to the appropriate //coordinate geotrans[3] += yoffset*geotrans[5]; #ifdef DEBUG std::cerr<<"Filename: "<<std::setw(20)<<filename<<" Xoffset: "<<std::setw(6)<<xoffset<<" Yoffset: "<<std::setw(6)<<yoffset<<" Geotrans0: "<<std::setw(10)<<std::setprecision(10)<<std::fixed<<geotrans[0]<<" Geotrans3: "<<std::setw(10)<<std::setprecision(10)<<std::fixed<<geotrans[3]<< std::endl; #endif fout->SetGeoTransform(geotrans); const char* projection_string=fintempl->GetProjectionRef(); fout->SetProjection(projection_string); GDALClose(fintempl); for(int y=0;y<view_height;y++) oband->RasterIO(GF_Write, 0, y, viewWidth(), 1, data[y].data(), viewWidth(), 1, myGDALType(), 0, 0); GDALClose(fout); }
void RenderView::mapRectToPaintInvalidationBacking(const RenderLayerModelObject* paintInvalidationContainer, LayoutRect& rect, ViewportConstrainedPosition viewportConstraint, const PaintInvalidationState* state) const { if (document().printing()) return; if (style()->slowIsFlippedBlocksWritingMode()) { // We have to flip by hand since the view's logical height has not been determined. We // can use the viewport width and height. if (style()->isHorizontalWritingMode()) rect.setY(viewHeight() - rect.maxY()); else rect.setX(viewWidth() - rect.maxX()); } adjustViewportConstrainedOffset(rect, viewportConstraint); // Apply our transform if we have one (because of full page zooming). if (!paintInvalidationContainer && layer() && layer()->transform()) rect = layer()->transform()->mapRect(rect); ASSERT(paintInvalidationContainer); if (paintInvalidationContainer == this) return; Element* owner = document().ownerElement(); if (!owner) return; if (RenderBox* obj = owner->renderBox()) { // Intersect the viewport with the paint invalidation rect. LayoutRect viewRectangle = viewRect(); rect.intersect(viewRectangle); // Adjust for scroll offset of the view. rect.moveBy(-viewRectangle.location()); // Adjust for frame border. rect.moveBy(obj->contentBoxRect().location()); obj->mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, 0); } }
void RenderView::layout() { SubtreeLayoutScope layoutScope(*this); bool relayoutChildren = (!m_frameView || width() != viewWidth() || height() != viewHeight()); if (relayoutChildren) { layoutScope.setChildNeedsLayout(this); for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { if ((child->isBox() && toRenderBox(child)->hasRelativeLogicalHeight()) || child->style()->logicalHeight().isPercent() || child->style()->logicalMinHeight().isPercent() || child->style()->logicalMaxHeight().isPercent()) layoutScope.setChildNeedsLayout(child); } } if (!needsLayout()) return; RenderFlexibleBox::layout(); clearNeedsLayout(); }
void RenderView::layout() { StackStats::LayoutCheckPoint layoutCheckPoint; if (!document()->paginated()) setPageLogicalHeight(0); if (shouldUsePrintingLayout()) m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = logicalWidth(); // Use calcWidth/Height to get the new width/height, since this will take the full page zoom factor into account. bool relayoutChildren = !shouldUsePrintingLayout() && (!m_frameView || width() != viewWidth() || height() != viewHeight()); if (relayoutChildren) { setChildNeedsLayout(true, MarkOnlyThis); for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { if ((child->isBox() && toRenderBox(child)->hasRelativeLogicalHeight()) || child->style()->logicalHeight().isPercent() || child->style()->logicalMinHeight().isPercent() || child->style()->logicalMaxHeight().isPercent()) child->setChildNeedsLayout(true, MarkOnlyThis); } } ASSERT(!m_layoutState); if (!needsLayout()) return; LayoutState state; // FIXME: May be better to push a clip and avoid issuing offscreen repaints. state.m_clipped = false; state.m_pageLogicalHeight = m_pageLogicalHeight; state.m_pageLogicalHeightChanged = m_pageLogicalHeightChanged; state.m_isPaginated = state.m_pageLogicalHeight; m_pageLogicalHeightChanged = false; m_layoutState = &state; m_layoutPhase = RenderViewNormalLayout; bool needsTwoPassLayoutForAutoLogicalHeightRegions = hasRenderNamedFlowThreads() && flowThreadController()->hasAutoLogicalHeightRegions() && flowThreadController()->hasRenderNamedFlowThreadsNeedingLayout(); if (needsTwoPassLayoutForAutoLogicalHeightRegions) flowThreadController()->resetRegionsOverrideLogicalContentHeight(); layoutContent(state); if (needsTwoPassLayoutForAutoLogicalHeightRegions) { m_layoutPhase = ConstrainedFlowThreadsLayoutInAutoLogicalHeightRegions; flowThreadController()->markAutoLogicalHeightRegionsForLayout(); layoutContent(state); } #ifndef NDEBUG checkLayoutState(state); #endif m_layoutState = 0; setNeedsLayout(false); }
void RenderView::calcHeight() { if (!printing() && m_frameView) m_height = viewHeight(); }
/// !!!! void TableBody::centerVertically(int row) { int topcell = row - viewHeight() / (cellHeight() * 2); setTopCell(qMax(topcell, 0)); update(); }
void RenderView::layout() { if (!document()->paginated()) setPageLogicalHeight(0); if (shouldUsePrintingLayout()) m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = logicalWidth(); // Use calcWidth/Height to get the new width/height, since this will take the full page zoom factor into account. bool relayoutChildren = !shouldUsePrintingLayout() && (!m_frameView || width() != viewWidth() || height() != viewHeight()); if (relayoutChildren) { setChildNeedsLayout(true, MarkOnlyThis); for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { if ((child->isBox() && toRenderBox(child)->hasRelativeLogicalHeight()) || child->style()->logicalHeight().isPercent() || child->style()->logicalMinHeight().isPercent() || child->style()->logicalMaxHeight().isPercent()) child->setChildNeedsLayout(true, MarkOnlyThis); } } ASSERT(!m_layoutState); LayoutState state; // FIXME: May be better to push a clip and avoid issuing offscreen repaints. state.m_clipped = false; state.m_pageLogicalHeight = m_pageLogicalHeight; state.m_pageLogicalHeightChanged = m_pageLogicalHeightChanged; state.m_isPaginated = state.m_pageLogicalHeight; m_pageLogicalHeightChanged = false; m_layoutState = &state; if (needsLayout()) { RenderBlock::layout(); if (hasRenderNamedFlowThreads()) flowThreadController()->layoutRenderNamedFlowThreads(); } ASSERT(layoutDelta() == LayoutSize()); ASSERT(m_layoutStateDisableCount == 0); ASSERT(m_layoutState == &state); m_layoutState = 0; setNeedsLayout(false); }
void RenderView::calcHeight() { if (!printing() && m_frameView) setHeight(viewHeight()); }
// FIXME(sky): remove double RenderView::layoutViewportHeight() const { return viewHeight(); }
// FIXME(sky): remove double RenderView::layoutViewportHeight() const { return viewHeight(IncludeScrollbars); }
int RenderView::viewLogicalHeight() const { return viewHeight(ExcludeScrollbars); }
void RenderView::layout() { StackStats::LayoutCheckPoint layoutCheckPoint; if (!document().paginated()) setPageLogicalHeight(0); if (shouldUsePrintingLayout()) m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = logicalWidth(); // Use calcWidth/Height to get the new width/height, since this will take the full page zoom factor into account. bool relayoutChildren = !shouldUsePrintingLayout() && (width() != viewWidth() || height() != viewHeight()); if (relayoutChildren) { setChildNeedsLayout(MarkOnlyThis); for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { if (!child->isBox()) continue; RenderBox& box = toRenderBox(*child); if (box.hasRelativeLogicalHeight() || box.hasViewportPercentageLogicalHeight() || box.style()->logicalHeight().isPercent() || box.style()->logicalMinHeight().isPercent() || box.style()->logicalMaxHeight().isPercent() || box.style()->logicalHeight().isViewportPercentage() || box.style()->logicalMinHeight().isViewportPercentage() || box.style()->logicalMaxHeight().isViewportPercentage() #if ENABLE(SVG) || box.isSVGRoot() #endif ) box.setChildNeedsLayout(MarkOnlyThis); } } ASSERT(!m_layoutState); if (!needsLayout()) return; m_layoutState = std::make_unique<LayoutState>(); bool isSeamlessAncestorInFlowThread = initializeLayoutState(*m_layoutState); m_pageLogicalHeightChanged = false; if (checkTwoPassLayoutForAutoHeightRegions()) layoutContentInAutoLogicalHeightRegions(*m_layoutState); else layoutContent(*m_layoutState); layoutContentToComputeOverflowInRegions(*m_layoutState); #ifndef NDEBUG checkLayoutState(*m_layoutState); #endif m_layoutState = nullptr; clearNeedsLayout(); if (isSeamlessAncestorInFlowThread) flowThreadController().setCurrentRenderFlowThread(0); }
int RenderView::viewLogicalHeight() const { int height = style()->isHorizontalWritingMode() ? viewHeight() : viewWidth(); return height; }
//?? void TableBody::showRange(int from, int to) { int h = viewHeight() / cellHeight(); if (to >= topCell() + h) setTopCell(qMax(0, qMin(from, to - h + 1))); }
int RenderView::viewLogicalHeight() const { return viewHeight(); }
void RenderView::layout() { if (!document().paginated()) setPageLogicalHeight(0); if (shouldUsePrintingLayout()) m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = logicalWidth(); SubtreeLayoutScope layoutScope(*this); // Use calcWidth/Height to get the new width/height, since this will take the full page zoom factor into account. bool relayoutChildren = !shouldUsePrintingLayout() && (!m_frameView || width() != viewWidth() || height() != viewHeight()); if (relayoutChildren) { layoutScope.setChildNeedsLayout(this); for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { if (child->isSVGRoot()) continue; if ((child->isBox() && toRenderBox(child)->hasRelativeLogicalHeight()) || child->style()->logicalHeight().isPercent() || child->style()->logicalMinHeight().isPercent() || child->style()->logicalMaxHeight().isPercent()) layoutScope.setChildNeedsLayout(child); } if (document().svgExtensions()) document().accessSVGExtensions().invalidateSVGRootsWithRelativeLengthDescendents(&layoutScope); } ASSERT(!m_layoutState); if (!needsLayout()) return; LayoutState rootLayoutState(pageLogicalHeight(), pageLogicalHeightChanged(), *this); m_pageLogicalHeightChanged = false; layoutContent(); #if ENABLE(ASSERT) checkLayoutState(); #endif clearNeedsLayout(); }
void RenderView::layout() { if (printing()) m_minPrefWidth = m_maxPrefWidth = width(); // Use calcWidth/Height to get the new width/height, since this will take the full page zoom factor into account. bool relayoutChildren = !printing() && (!m_frameView || width() != viewWidth() || height() != viewHeight()); if (relayoutChildren) { setChildNeedsLayout(true, false); for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { if (child->style()->height().isPercent() || child->style()->minHeight().isPercent() || child->style()->maxHeight().isPercent()) child->setChildNeedsLayout(true, false); } } ASSERT(!m_layoutState); LayoutState state; // FIXME: May be better to push a clip and avoid issuing offscreen repaints. state.m_clipped = false; m_layoutState = &state; if (needsLayout()) RenderBlock::layout(); // Reset overflowWidth and overflowHeight, since they act as a lower bound for docWidth() and docHeight(). setOverflowWidth(width()); setOverflowHeight(height()); setOverflowWidth(docWidth()); setOverflowHeight(docHeight()); ASSERT(layoutDelta() == IntSize()); ASSERT(m_layoutStateDisableCount == 0); ASSERT(m_layoutState == &state); m_layoutState = 0; setNeedsLayout(false); }
int RenderView::viewLogicalHeight() const { return style()->isHorizontalWritingMode() ? viewHeight(ExcludeScrollbars) : viewWidth(ExcludeScrollbars); }
void RenderView::layout() { if (!document()->paginated()) setPageHeight(0); m_absoluteOverflow.clear(); if (printing()) m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = width(); // Use calcWidth/Height to get the new width/height, since this will take the full page zoom factor into account. bool relayoutChildren = !printing() && (!m_frameView || width() != viewWidth() || height() != viewHeight()); if (relayoutChildren) { setChildNeedsLayout(true, false); for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { if (child->style()->logicalHeight().isPercent() || child->style()->logicalMinHeight().isPercent() || child->style()->logicalMaxHeight().isPercent()) child->setChildNeedsLayout(true, false); } } ASSERT(!m_layoutState); LayoutState state; // FIXME: May be better to push a clip and avoid issuing offscreen repaints. state.m_clipped = false; state.m_pageHeight = m_pageHeight; state.m_pageHeightChanged = m_pageHeightChanged; m_pageHeightChanged = false; m_layoutState = &state; if (needsLayout()) RenderBlock::layout(); #if ENABLE(VIEWPORT_REFLOW) calcReflowWidth(); #endif // Reset overflow and then replace it with docWidth and docHeight. m_overflow.clear(); int leftOverflow = docLeft(); addLayoutOverflow(IntRect(leftOverflow, 0, docWidth(leftOverflow), docHeight())); ASSERT(layoutDelta() == IntSize()); ASSERT(m_layoutStateDisableCount == 0); ASSERT(m_layoutState == &state); m_layoutState = 0; setNeedsLayout(false); }
double RenderView::layoutViewportHeight() const { float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; return viewHeight(IncludeScrollbars) / scale; }
bool in_grid(int x, int y) const { return 0<=x && x<viewWidth() && 0<=y && y<viewHeight(); }
void RenderView::layout() { layoutCounter.startCounting(); if (printing()) m_minPrefWidth = m_maxPrefWidth = m_width; // Use calcWidth/Height to get the new width/height, since this will take the full page zoom factor into account. bool relayoutChildren = !printing() && (!m_frameView || m_width != viewWidth() || m_height != viewHeight()); if (relayoutChildren) { setChildNeedsLayout(true, false); for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { if (child->style()->height().isPercent() || child->style()->minHeight().isPercent() || child->style()->maxHeight().isPercent()) child->setChildNeedsLayout(true, false); } } ASSERT(!m_layoutState); LayoutState state; IntRect viewRectangle = viewRect(); // An empty rect is not valid viewRect. state.m_clipped = !viewRectangle.isEmpty(); if (state.m_clipped) { state.m_clipRect = IntRect(IntPoint(0, 0), viewRectangle.size()); state.m_offset = IntSize(viewRectangle.x(), viewRectangle.y()); } m_layoutState = &state; if (needsLayout()) RenderBlock::layout(); // Ensure that docWidth() >= width() and docHeight() >= height(). setOverflowWidth(m_width); setOverflowHeight(m_height); setOverflowWidth(docWidth()); setOverflowHeight(docHeight()); ASSERT(m_layoutStateDisableCount == 0); ASSERT(m_layoutState == &state); m_layoutState = 0; setNeedsLayout(false); layoutCounter.stopCounting(); }