本文整理汇总了C++中webcore::IntRect类的典型用法代码示例。如果您正苦于以下问题:C++ IntRect类的具体用法?C++ IntRect怎么用?C++ IntRect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IntRect类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:,项目名称:,代码行数:27,代码来源:
示例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);
}
开发者ID:Androtos,项目名称:toolchain_benchmark,代码行数:30,代码来源:CachedHistory.cpp
示例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);
}
开发者ID:,项目名称:,代码行数:7,代码来源:
示例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);
}
开发者ID:3163504123,项目名称:phantomjs,代码行数:59,代码来源:ewk_view_single.cpp
示例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);
}
开发者ID:,项目名称:,代码行数:8,代码来源:
示例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;
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:10,代码来源:CachedNode.cpp
示例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);
}
开发者ID:,项目名称:,代码行数:10,代码来源:
示例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;
}
开发者ID:,项目名称:,代码行数:11,代码来源:
示例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;
}
开发者ID:cexer,项目名称:wke,代码行数:12,代码来源:wkeChromeClient.cpp
示例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;
}
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:49,代码来源:EAWebKitDocumentNavigator.cpp
示例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);
}
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:35,代码来源:WebViewPrivate.cpp
示例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);
}
开发者ID:ZeusbaseWeb,项目名称:webkit,代码行数:16,代码来源:WebPageCompositor.cpp
示例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();
}
开发者ID:azrul2202,项目名称:WebKit-Smartphone,代码行数:44,代码来源:SelectionHandler.cpp
示例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);
}
开发者ID:azrul2202,项目名称:WebKit-Smartphone,代码行数:19,代码来源:SelectionHandler.cpp
示例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;
}
}
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:25,代码来源:EAWebKitDocumentNavigator.cpp
示例16: imageRect
WebCore::IntRect InjectedBundleHitTestResult::imageRect() const
{
WebCore::IntRect imageRect = m_hitTestResult.imageRect();
if (imageRect.isEmpty())
return imageRect;
// The image rect in WebCore::HitTestResult is in frame coordinates, but we need it in WKView
// coordinates since WebKit2 clients don't have enough context to do the conversion themselves.
WebFrame* webFrame = frame();
if (!webFrame)
return imageRect;
WebCore::Frame* coreFrame = webFrame->coreFrame();
if (!coreFrame)
return imageRect;
WebCore::FrameView* view = coreFrame->view();
if (!view)
return imageRect;
return view->contentsToRootView(imageRect);
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:22,代码来源:InjectedBundleHitTestResult.cpp
示例17: doAxisCheck
bool DocumentNavigator::doAxisCheck(WebCore::IntRect rect)
{
int left = rect.x();
int right = rect.x() + rect.width();
int top = rect.y();
int bottom = rect.y() + rect.height();
//abaldeva: Feel like only one check is enough?
//Fixes the navigation to the yahoo.com sports section link
switch (mDirection)
{
case EA::WebKit::JumpRight:
if(mStrictAxesCheck)
return left >= mStartingPosition.x();
else
return !(left<mStartingPosition.x() && right<mStartingPosition.x());
break;
case EA::WebKit::JumpDown:
if(mStrictAxesCheck)
return top >= mStartingPosition.y();
else
return !(top<mStartingPosition.y() && bottom<mStartingPosition.y());
break;
case EA::WebKit::JumpLeft:
if(mStrictAxesCheck)
return right <= mStartingPosition.x();
else
return !(left>mStartingPosition.x() && right>mStartingPosition.x());
break;
case EA::WebKit::JumpUp:
if(mStrictAxesCheck)
return bottom <= mStartingPosition.y();
else
return !(top>mStartingPosition.y() && bottom>mStartingPosition.y());
break;
default:
EAW_FAIL_MSG("Should not have got here\n");
}
return false;
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:51,代码来源:EAWebKitDocumentNavigator.cpp
示例18: setViewNeedsDisplay
void PageClientImpl::setViewNeedsDisplay(const WebCore::IntRect& rect)
{
gtk_widget_queue_draw_area(m_viewWidget, rect.x(), rect.y(), rect.width(), rect.height());
}
开发者ID:kodybrown,项目名称:webkit,代码行数:4,代码来源:PageClientImpl.cpp
示例19: scrollBackingStore
void WebViewPrivate::scrollBackingStore(WebCore::FrameView* view, int dx, int dy, const WebCore::IntRect& scrollViewRect, const WebCore::IntRect& clipRect)
{
IntRect updateRect = clipRect;
updateRect.intersect(scrollViewRect);
#if 0
dy = -dy;
dx = -dx;
int svWidth = scrollViewRect.width();
int svHeight = scrollViewRect.height();
int dirtyX = 0, dirtyY = 0, dirtyW = 0, dirtyH = 0;
if (dy == 0 && dx < 0 && -dx < svWidth) {
dirtyW = -dx;
dirtyH = svHeight;
}
else if (dy == 0 && dx > 0 && dx < svWidth) {
dirtyX = svWidth - dx;
dirtyW = dx;
dirtyH = svHeight;
}
else if (dx == 0 && dy < 0 && -dy < svHeight) {
dirtyW = svWidth;
dirtyH = -dy;
}
else if (dx == 0 && dy > 0 && dy < svHeight) {
dirtyY = svHeight - dy;
dirtyW = svWidth;
dirtyH = dy;
}
if (m_webView->viewWindow() && dirtyW) {
m_srcRect.x = dx > 0 ? dx + scrollViewRect.x() : scrollViewRect.x();
m_srcRect.y = dy > 0 ? dy + scrollViewRect.y() : scrollViewRect.y();
m_srcRect.w = dx > 0 ? scrollViewRect.width() - dx : scrollViewRect.width() + dx;
m_srcRect.h = dy > 0 ? scrollViewRect.height() - dy : scrollViewRect.height() + dy;
m_dstRect.x = dx > 0 ? scrollViewRect.x() : -dx + scrollViewRect.x();
m_dstRect.y = dy > 0 ? scrollViewRect.y() : -dy + scrollViewRect.y();
m_dstRect.w = dx > 0 ? scrollViewRect.width() - dx : scrollViewRect.width() + dx;
m_dstRect.h = dy > 0 ? scrollViewRect.height() -dy : scrollViewRect.height() + dy;
int x, y, w, h = 0;
if (dx > 0) {
m_srcRect.x += m_scrollUpdateRect.width();
m_srcRect.w -= m_scrollUpdateRect.width();
x = scrollViewRect.x() + dirtyX - m_scrollUpdateRect.width();
w = dirtyW + m_scrollUpdateRect.width();
} else if (dx < 0) {
m_dstRect.x += m_scrollUpdateRect.width();
m_srcRect.w -= m_scrollUpdateRect.width();
x = scrollViewRect.x() + dirtyX + m_scrollUpdateRect.width();
w = dirtyW + m_scrollUpdateRect.width();
} else {
x = scrollViewRect.x() + dirtyX;
w = dirtyW;
}
if (dy > 0) {
m_srcRect.y += m_scrollUpdateRect.height();
m_srcRect.h -= m_scrollUpdateRect.height();
y = scrollViewRect.y() + dirtyY - m_scrollUpdateRect.height();
h = dirtyH + m_scrollUpdateRect.height();
} else if (dy < 0) {
m_dstRect.y += m_scrollUpdateRect.height();
m_srcRect.h -= m_scrollUpdateRect.height();
y = scrollViewRect.y() + dirtyY + m_scrollUpdateRect.height();
h = dirtyH + m_scrollUpdateRect.height();
} else {
y = scrollViewRect.y() + dirtyY;
h = dirtyH;
}
Uint32 rmask, gmask, bmask, amask;
#if !PLATFORM(AMIGAOS4) && SDL_BYTEORDER == SDL_BIG_ENDIAN
rmask = 0xff000000;
gmask = 0x00ff0000;
bmask = 0x0000ff00;
amask = 0x000000ff;
#else
rmask = 0x00ff0000;
gmask = 0x0000ff00;
bmask = 0x000000ff;
amask = 0xff000000;
#endif
if (m_scrollSurface)
SDL_FreeSurface(m_scrollSurface);
m_scrollSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, m_dstRect.w, m_dstRect.h , 32, rmask, gmask, bmask, amask);
SDL_Rect dRect = {0, 0, m_dstRect.w, m_dstRect.h};
SDL_BlitSurface(m_webView->viewWindow(), &m_srcRect, m_scrollSurface, &dRect);
m_scrollUpdateRect = IntRect(x, y, w, h);
m_scrollUpdateRect.intersect(scrollViewRect);
Scrollbar* hBar = view->horizontalScrollbar();
Scrollbar* vBar = view->verticalScrollbar();
if (dx && hBar)
//.........这里部分代码省略.........
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:101,代码来源:WebViewPrivate.cpp
示例20: fixUpFocusRects
void CachedNode::fixUpFocusRects()
{
if (mFixedUpFocusRects)
return;
mFixedUpFocusRects = true;
if (mNavableRects <= 1)
return;
#if DEBUG_NAV_UI
{
WebCore::IntRect* boundsPtr = mFocusRing.begin() - 1;
const WebCore::IntRect* const boundsEnd = mFocusRing.begin() + mFocusRing.size();
while (++boundsPtr < boundsEnd)
LOGD("%s %d:(%d, %d, %d, %d)\n", __FUNCTION__, boundsPtr - mFocusRing.begin(),
boundsPtr->x(), boundsPtr->y(), boundsPtr->width(), boundsPtr->height());
}
#endif
// q: need to know when rects are for drawing and hit-testing, but not mouse down calcs?
bool again;
do {
again = false;
size_t size = mFocusRing.size();
WebCore::IntRect* unitBoundsPtr = mFocusRing.begin() - 1;
const WebCore::IntRect* const unitBoundsEnd = mFocusRing.begin() + size;
while (++unitBoundsPtr < unitBoundsEnd) {
// any other unitBounds to the left or right of this one?
int unitTop = unitBoundsPtr->y();
int unitBottom = unitBoundsPtr->bottom();
int unitLeft = unitBoundsPtr->x();
int unitRight = unitBoundsPtr->right();
WebCore::IntRect* testBoundsPtr = mFocusRing.begin() - 1;
while (++testBoundsPtr < unitBoundsEnd) {
if (unitBoundsPtr == testBoundsPtr)
continue;
int testTop = testBoundsPtr->y();
int testBottom = testBoundsPtr->bottom();
int testLeft = testBoundsPtr->x();
int testRight = testBoundsPtr->right();
int candidateTop = unitTop > testTop ? unitTop : testTop;
int candidateBottom = unitBottom < testBottom ? unitBottom : testBottom;
int candidateLeft = unitRight < testLeft ? unitRight : testRight;
int candidateRight = unitRight > testLeft ? unitLeft : testLeft;
bool leftRight = true;
if (candidateTop + OVERLAP >= candidateBottom ||
candidateLeft + OVERLAP >= candidateRight) {
candidateTop = unitBottom < testTop ? unitBottom : testBottom;
candidateBottom = unitBottom > testTop ? unitTop : testTop;
candidateLeft = unitLeft > testLeft ? unitLeft : testLeft;
candidateRight = unitRight < testRight ? unitRight : testRight;
if (candidateTop + OVERLAP >= candidateBottom ||
candidateLeft + OVERLAP >= candidateRight)
continue;
leftRight = false;
}
// construct candidate to add
WebCore::IntRect candidate = WebCore::IntRect(candidateLeft, candidateTop,
candidateRight - candidateLeft, candidateBottom - candidateTop);
// does a different unit bounds intersect the candidate? if so, don't add
WebCore::IntRect* checkBoundsPtr = mFocusRing.begin() - 1;
while (++checkBoundsPtr < unitBoundsEnd) {
if (checkBoundsPtr->intersects(candidate) == false)
continue;
if (leftRight) {
if (candidateTop >= checkBoundsPtr->y() &&
candidateBottom > checkBoundsPtr->bottom())
candidateTop = checkBoundsPtr->bottom();
else if (candidateTop < checkBoundsPtr->y() &&
candidateBottom <= checkBoundsPtr->bottom())
candidateBottom = checkBoundsPtr->y();
else
goto nextCheck;
} else {
if (candidateLeft >= checkBoundsPtr->x() &&
candidateRight > checkBoundsPtr->right())
candidateLeft = checkBoundsPtr->right();
else if (candidateLeft < checkBoundsPtr->x() &&
candidateRight <= checkBoundsPtr->right())
candidateRight = checkBoundsPtr->x();
else
goto nextCheck;
}
}
candidate = WebCore::IntRect(candidateLeft, candidateTop,
candidateRight - candidateLeft, candidateBottom - candidateTop);
ASSERT(candidate.isEmpty() == false);
#if DEBUG_NAV_UI
LOGD("%s %d:(%d, %d, %d, %d)\n", __FUNCTION__, mFocusRing.size(),
candidate.x(), candidate.y(), candidate.width(), candidate.height());
#endif
mFocusRing.append(candidate);
again = true;
goto tryAgain;
nextCheck:
continue;
}
}
tryAgain:
;
} while (again);
}
开发者ID:,项目名称:,代码行数:99,代码来源:
注:本文中的webcore::IntRect类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论