void SingleSplitView::DidChangeBounds(const gfx::Rect& previous, const gfx::Rect& current) { if(resize_leading_on_bounds_change_) { // We do not update divider_offset_ on minimize (to zero) and on restore // (to largest value). As a result we get back to the original value upon // window restore. bool is_minimize_or_restore = previous.height()==0 || current.height()==0; if(!is_minimize_or_restore) { if(is_horizontal_) { divider_offset_ += (current.width() - previous.width()) / 2; } else { divider_offset_ += (current.height() - previous.height()) / 2; } if(divider_offset_ < 0) { divider_offset_ = kDividerSize; } } } View::DidChangeBounds(previous, current); }
static void paintArtifactToWebDisplayItemList(WebDisplayItemList* list, const PaintArtifact& artifact, const gfx::Rect& bounds) { if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { // This is a temporary path to paint the artifact using the paint chunk // properties. Ultimately, we should instead split the artifact into // separate layers and send those to the compositor, instead of sending // one big flat SkPicture. SkRect skBounds = SkRect::MakeXYWH(bounds.x(), bounds.y(), bounds.width(), bounds.height()); RefPtr<SkPicture> picture = paintArtifactToSkPicture(artifact, skBounds); list->appendDrawingItem(WebRect(bounds.x(), bounds.y(), bounds.width(), bounds.height()), picture.get()); return; } artifact.appendToWebDisplayItemList(list); }
bool Rect::SharesEdgeWith(const gfx::Rect& rect) const { return (y()==rect.y() && height()==rect.height() && (x()==rect.right() || right()==rect.x())) || (x()==rect.x() && width()==rect.width() && (y()==rect.bottom() || bottom()==rect.y())); }
void BrowserBubble::SetAbsoluteBounds(const gfx::Rect& window_bounds) { // Convert screen coordinates to frame relative. gfx::Point relative_origin = window_bounds.origin(); view::View::ConvertPointToView(NULL, frame_->GetRootView(), &relative_origin); SetBounds(relative_origin.x(), relative_origin.y(), window_bounds.width(), window_bounds.height()); }
gfx::Rect CustomFrameView::GetWindowBoundsForClientBounds( const gfx::Rect& client_bounds) const { int top_height = NonClientTopBorderHeight(); int border_thickness = NonClientBorderThickness(); return gfx::Rect(std::max(0, client_bounds.x()-border_thickness), std::max(0, client_bounds.y()-top_height), client_bounds.width()+(2*border_thickness), client_bounds.height()+top_height+border_thickness); }
void Label::PaintText(gfx::Canvas* canvas, const std::wstring& text, const gfx::Rect& text_bounds, int flags) { canvas->DrawStringInt(text, font_, color_, text_bounds.x(), text_bounds.y(), text_bounds.width(), text_bounds.height(), flags); if(HasFocus() || paint_as_focused_) { gfx::Rect focus_bounds = text_bounds; focus_bounds.Inset(-kFocusBorderPadding, -kFocusBorderPadding); canvas->DrawFocusRect(focus_bounds.x(), focus_bounds.y(), focus_bounds.width(), focus_bounds.height()); } }
virtual gfx::Rect GetViewBounds() const { X; fprintf(stderr, "GetViewBounds %d %d %d %d\n", bounds_.x(), bounds_.y(), bounds_.width(), bounds_.height()); return bounds_; }
virtual void SetBounds(const gfx::Rect& rect) { X; fprintf(stderr, "SetBounds %d %d %d %d\n", rect.x(), rect.y(), rect.width(), rect.height()); bounds_ = rect; }