本文整理汇总了C++中webcore::IntRect类的典型用法代码示例。如果您正苦于以下问题:C++ IntRect类的具体用法?C++ IntRect怎么用?C++ IntRect使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IntRect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Clip
bool CachedNode::Clip(const WebCore::IntRect& outer, WebCore::IntRect* inner,
WTF::Vector<WebCore::IntRect>* rings)
{
if (outer.contains(*inner))
return true;
// DBG_NAV_LOGD("outer:{%d,%d,%d,%d} does not contain inner:{%d,%d,%d,%d}",
// outer.x(), outer.y(), outer.width(), outer.height(),
// inner->x(), inner->y(), inner->width(), inner->height());
bool intersects = outer.intersects(*inner);
size_t size = intersects ? rings->size() : 0;
*inner = WebCore::IntRect(0, 0, 0, 0);
if (intersects) {
WebCore::IntRect * const start = rings->begin();
WebCore::IntRect* ring = start + size - 1;
do {
ring->intersect(outer);
if (ring->isEmpty()) {
if ((size_t) (ring - start) != --size)
*ring = start[size];
} else
inner->unite(*ring);
} while (ring-- != start);
}
rings->shrink(size);
// DBG_NAV_LOGD("size:%d", size);
return size != 0;
}
示例2: setWorking
void CachedHistory::setWorking(CachedFrame::Direction newMove,
const CachedNode* cursor, const WebCore::IntRect& viewBounds)
{
CachedFrame::Direction lastAxis = (CachedFrame::Direction) (mLastMove & ~CachedFrame::RIGHT_DOWN); // up, left or uninitialized
CachedFrame::Direction newAxis = (CachedFrame::Direction) (newMove & ~CachedFrame::RIGHT_DOWN);
bool change = newAxis != lastAxis;
mDirectionChange = change && mLastMove != CachedFrame::UNINITIALIZED;
if (cursor != NULL || mLastMove != CachedFrame::UNINITIALIZED) {
mPriorMove = mLastMove;
mLastMove = newMove;
}
const WebCore::IntRect* navBounds = &mNavBounds;
if (cursor != NULL) {
WebCore::IntRect cursorBounds;
cursor->getBounds(&cursorBounds);
if (cursorBounds.isEmpty() == false)
mNavBounds = cursorBounds;
}
if (change) { // uninitialized or change in direction
if (lastAxis != CachedFrame::LEFT && navBounds->height() > 0) {
mMinWorkingHorizontal = navBounds->y();
mMaxWorkingHorizontal = navBounds->bottom();
}
if (lastAxis != CachedFrame::UP && navBounds->width() > 0) {
mMinWorkingVertical = navBounds->x();
mMaxWorkingVertical = navBounds->right();
}
}
pinMaxMin(viewBounds);
}
示例3: paintContents
void NonCompositedContentHost::paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext& context, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect)
{
context.translate(-m_layerAdjust);
WebCore::IntRect adjustedClipRect = clipRect;
adjustedClipRect.move(m_layerAdjust);
m_webView->paintRootLayer(context, adjustedClipRect);
}
示例4: DBG
static inline void _ewk_view_single_scroll_process_single(Ewk_View_Smart_Data* smartData, void* pixels, Evas_Coord width, Evas_Coord height, const WebCore::IntSize& scrollOffset, const WebCore::IntRect& rectToScroll)
{
int scrollX = rectToScroll.x();
int scrollY = rectToScroll.y();
int scrollWidth = rectToScroll.width();
int scrollHeight = rectToScroll.height();
DBG("%d,%d + %d,%d %+03d,%+03d, store: %p %dx%d",
scrollX, scrollY, scrollWidth, scrollHeight, scrollOffset.width(), scrollOffset.height(), pixels, width, height);
if (abs(scrollOffset.width()) >= scrollWidth || abs(scrollOffset.height()) >= scrollHeight) {
ewk_view_repaint_add(smartData->_priv, scrollX, scrollY, scrollWidth, scrollHeight);
return;
}
if (scrollX < 0) {
scrollWidth += scrollX;
scrollX = 0;
}
if (scrollY < 0) {
scrollHeight += scrollY;
scrollY = 0;
}
if (scrollX + scrollWidth > width)
scrollWidth = width - scrollX;
if (scrollY + scrollHeight > height)
scrollHeight = height - scrollY;
if (scrollWidth <= 0 || scrollHeight <= 0)
return;
int sourceX = scrollOffset.width() < 0 ? abs(scrollOffset.width()) : 0;
int sourceY = scrollOffset.height() < 0 ? abs(scrollOffset.height()) : 0;
int destinationX = scrollOffset.width() < 0 ? 0 : scrollOffset.width();
int destinationY = scrollOffset.height() < 0 ? 0 : scrollOffset.height();
int copyWidth = scrollWidth - abs(scrollOffset.width());
int copyHeight = scrollHeight - abs(scrollOffset.height());
if (scrollOffset.width() || scrollOffset.height()) {
_ewk_view_screen_move(static_cast<uint32_t*>(pixels), destinationX, destinationY, sourceX, sourceY, copyWidth, copyHeight, width);
evas_object_image_data_update_add(smartData->backing_store, destinationX, destinationY, copyWidth, copyHeight);
}
Eina_Rectangle verticalUpdate;
verticalUpdate.x = destinationX ? 0 : copyWidth - 1;
verticalUpdate.y = 0;
verticalUpdate.w = abs(scrollOffset.width());
verticalUpdate.h = scrollHeight;
if (verticalUpdate.w && verticalUpdate.h)
ewk_view_repaint_add(smartData->_priv, verticalUpdate.x, verticalUpdate.y, verticalUpdate.w, verticalUpdate.h);
Eina_Rectangle horizontalUpdate;
horizontalUpdate.x = destinationX;
horizontalUpdate.y = destinationY ? 0 : copyHeight - 1;
horizontalUpdate.w = copyWidth;
horizontalUpdate.h = abs(scrollOffset.height());
if (horizontalUpdate.w && horizontalUpdate.h)
ewk_view_repaint_add(smartData->_priv, horizontalUpdate.x, horizontalUpdate.y, horizontalUpdate.w, horizontalUpdate.h);
}
示例5: overlappedTileIndices
IntRect TilingData::overlappedTileIndices(const WebCore::IntRect &srcRect) const
{
int x = tileXIndexFromSrcCoord(srcRect.x());
int y = tileYIndexFromSrcCoord(srcRect.y());
int r = tileXIndexFromSrcCoord(srcRect.maxX());
int b = tileYIndexFromSrcCoord(srcRect.maxY());
return IntRect(x, y, r - x, b - y);
}
示例6: cursorRingBounds
WebCore::IntRect CachedNode::cursorRingBounds(const CachedFrame* frame) const
{
int partMax = mNavableRects;
ASSERT(partMax > 0);
WebCore::IntRect bounds = mCursorRing[0];
for (int partIndex = 1; partIndex < partMax; partIndex++)
bounds.unite(mCursorRing[partIndex]);
bounds.inflate(CURSOR_RING_HIT_TEST_RADIUS);
return mIsInLayer ? frame->adjustBounds(this, bounds) : bounds;
}
示例7: move
void CachedNode::move(int x, int y)
{
mBounds.move(x, y);
// mHitTestBounds will be moved by caller
WebCore::IntRect* first = mFocusRing.begin();
WebCore::IntRect* last = first + mFocusRing.size();
--first;
while (++first != last)
first->move(x, y);
}
示例8: rectOnScreen
WebCore::IntRect DOMHTMLInputElement::rectOnScreen()
{
RenderObject* renderer = m_element->renderer();
FrameView* view = m_element->document()->view();
if (!renderer || !view)
return WebCore::IntRect();
WebCore::IntRect coreRect = renderer->absoluteBoundingBoxRect();
coreRect.setLocation(view->contentsToWindow(coreRect.location()));
return coreRect;
}
示例9: windowToScreen
WebCore::IntRect ChromeClient::windowToScreen(const WebCore::IntRect& windowPoint) const
{
HWND hwnd = m_webView ? m_webView->hostWindow() : NULL;
if (!IsWindow(hwnd))
return windowPoint;
POINT tempPoint = { windowPoint.x(), windowPoint.y() };
ClientToScreen(hwnd, &tempPoint);
WebCore::IntRect screePoint(tempPoint.x, tempPoint.y, windowPoint.width(), windowPoint.height());
return screePoint;
}
示例10: WouldBeTrappedInElement
static bool WouldBeTrappedInElement(const WebCore::IntRect& rect, const WebCore::IntPoint& point, EA::WebKit::JumpDirection direction)
{
// If we're not inside, don't worry
if (rect.contains(point))
{
typedef WebCore::IntPoint Vector2D;
const WebCore::IntPoint centre = Average( rect.minXMaxYCorner(), rect.maxXMinYCorner() );
Vector2D pointToCentre = Subtract(centre,point);
Vector2D forward;
switch (direction)
{
// note these are 'backward
case EA::WebKit::JumpUp: forward = Vector2D(0,-100); break;
case EA::WebKit::JumpDown: forward = Vector2D(0,100); break;
case EA::WebKit::JumpLeft: forward = Vector2D(-100,0); break;
case EA::WebKit::JumpRight: forward = Vector2D(100,0); break;
}
// Basically, if the centre is behind us, don't jump there
if (DotProduct(forward,pointToCentre) < 0)
{
return false;
}
else
{
/*printf("(%d,%d) Trapped Inside Element (%d,%d)->(%d,%d): forward=(%d,%d) pointToCentre=(%d,%d) dot=%d\n",
point.x(),
point.y(),
rect.bottomLeft().x(),
rect.bottomLeft().y(),
rect.topRight().x(),
rect.topRight().y(),
forward.x(),
forward.y(),
pointToCentre.x(),
pointToCentre.y(),
DotProduct(forward,pointToCentre)
);*/
return true;
}
}
else
{
return false;
}
}
示例11: repaint
void WebViewPrivate::repaint(const WebCore::IntRect& windowRect, bool contentChanged, bool immediate, bool repaintContentOnly)
{
if (windowRect.isEmpty())
return;
IntRect rect = windowRect;
rect.intersect(m_rect);
if (rect.isEmpty())
return;
if (contentChanged) {
m_webView->addToDirtyRegion(rect);
/*Frame* focusedFrame = m_webView->page()->focusController()->focusedFrame();
if (focusedFrame) {
Scrollbar* hBar = focusedFrame->view()->horizontalScrollbar();
Scrollbar* vBar = focusedFrame->view()->verticalScrollbar();
// TODO : caculate the scroll delta and test this.
//if (dx && hBar)
if (hBar)
m_webView->addToDirtyRegion(IntRect(focusedFrame->view()->windowClipRect().x() + hBar->x(), focusedFrame->view()->windowClipRect().y() + hBar->y(), hBar->width(), hBar->height()));
//if (dy && vBar)
if (vBar)
m_webView->addToDirtyRegion(IntRect(focusedFrame->view()->windowClipRect().x() + vBar->x(), focusedFrame->view()->windowClipRect().y() + vBar->y(), vBar->width(), vBar->height()));
}*/
}
if (!repaintContentOnly)
sendExposeEvent(rect);
if (immediate) {
if (repaintContentOnly)
m_webView->updateBackingStore(core(m_webView->topLevelFrame())->view());
else
sendExposeEvent(rect);
}
}
示例12: findFixedElementRect
void WebPageCompositorPrivate::findFixedElementRect(LayerCompositingThread* layer, WebCore::IntRect& fixedElementRect)
{
if ((layer->hasFixedContainer() || layer->isFixedPosition() || layer->hasFixedAncestorInDOMTree()) && layer->layerRenderer()) {
IntRect fixedRect = layer->layerRenderer()->toPixelViewportCoordinates(layer->boundingBox());
// FIXME: It's possible that the rects don't intersect now, but will be connected by a fixed rect found later.
// We need to handle it as well.
if (fixedElementRect.isEmpty() || fixedElementRect.intersects(fixedRect)) // Unite rects if they intersect each other.
fixedElementRect.unite(fixedRect);
else if (fixedRect.y() < fixedElementRect.y()) // Replace the fixedElementRect with fixedRect if fixedRect is above it (closer to top).
fixedElementRect = fixedRect;
}
const Vector<RefPtr<LayerCompositingThread> >& sublayers = layer->sublayers();
for (size_t i = 0; i < sublayers.size(); i++)
findFixedElementRect(sublayers[i].get(), fixedElementRect);
}
示例13: setSelection
void SelectionHandler::setSelection(WebCore::IntPoint start, WebCore::IntPoint end)
{
m_selectionActive = true;
ASSERT(m_webPage && m_webPage->mainFrame() && m_webPage->mainFrame()->selection());
Frame* frame = m_webPage->mainFrame();
ASSERT(frame);
#if SHOWDEBUG_SELECTIONHANDLER
Olympia::Platform::log(Olympia::Platform::LogLevelInfo, "SelectionHandler::setSelection adjusted points %d, %d, %d, %d", start.x(), start.y(), end.x(), end.y());
#endif
bool selectionIsValid = true;
VisibleSelection newSelection(frame->visiblePositionForPoint(start), frame->visiblePositionForPoint(end));
// Validate the new points to avoid crossing frame or editing boundaries.
if (m_webPage->mainFrame() != m_webPage->focusedOrMainFrame() && m_webPage->focusedOrMainFrame()->ownerRenderer()) {
// Current focus frame is not the main frame, it must be a subframe.
WebCore::IntRect subframeRect = m_webPage->focusedOrMainFrame()->ownerRenderer()->absoluteContentBox();
if (!subframeRect.contains(start) || !subframeRect.contains(end)) {
// Requested selection points are outside of current frame.
selectionIsValid = false;
}
}
// Check whether selection is occurring inside of an input field. Do not handle as
// an else if, an input field may be active inside of a subframe.
if (m_webPage->m_inputHandler->isInputMode() && !selectionIsContainedByAnchorNode(newSelection)) {
// Requested selection points are not contained within the anchor node (input field).
selectionIsValid = false;
}
if (selectionIsValid) {
frame->selection()->setSelection(newSelection);
#if SHOWDEBUG_SELECTIONHANDLER
Olympia::Platform::log(Olympia::Platform::LogLevelInfo, "SelectionHandler::setSelection selection points valid, selection updated");
#endif
}
// Need to manually trigger notification as response to change.
// This needs to be set even if no selection change occurs to ensure client has accurate
// selection points.
selectionPositionChanged();
}
示例14: selectionPositionChanged
// Note: This is the only function in SelectionHandler in which the coordinate
// system is not entirely WebKit.
void SelectionHandler::selectionPositionChanged()
{
if (!m_selectionActive)
return;
// Get the transformed coordinates from the WebPage.
WebCore::IntRect startCaret = m_webPage->selectionStartCaretRect();
WebCore::IntRect endCaret = m_webPage->selectionEndCaretRect();
#if SHOWDEBUG_SELECTIONHANDLER
Olympia::Platform::log(Olympia::Platform::LogLevelInfo, "SelectionHandler::selectionPositionChanged Start Rect %d, %d, %dx%d End Rect%d, %d, %dx%d",
startCaret.x(), startCaret.y(), startCaret.width(), startCaret.height(),
endCaret.x(), endCaret.y(), endCaret.width(), endCaret.height());
#endif
m_webPage->m_client->selectionBounds(startCaret, endCaret);
}
示例15: TryingToDoPerpendicularJump
static bool TryingToDoPerpendicularJump(const WebCore::IntRect& rect, const WebCore::IntRect& previousRect, EA::WebKit::JumpDirection direction)
{
if (direction == EA::WebKit::JumpLeft || direction == EA::WebKit::JumpRight)
{
if (rect.maxXMinYCorner().x() <= previousRect.maxXMinYCorner().x() && rect.minXMinYCorner().x() >= previousRect.minXMinYCorner().x())
{
return true;
}
else
{
return false;
}
}
else
{
if (rect.maxXMinYCorner().y() <= previousRect.maxXMinYCorner().y() && rect.maxXMaxYCorner().y() >= previousRect.maxXMaxYCorner().y())
{
return true;
}
else
{
return false;
}
}
}