AppKit: Fix missing declarations and DOM guards in CPTableView and CPOutlineView

* CPTableView.j: Add forward @class declaration for CPTableView preceding _CPTableRowView.

* CPOutlineView.j:
  - Import CPCompatibility.j and declare the global document reference.
  - Replace partial DOM guards in -[CPDisclosureButton drawRect:] with an early return.
This commit is contained in:
David Richardson committed 2026-11-02 15:57:00 -06:00
1 parent 211a91ae50
commit e62c66f26c
2 files changed
+15 -16

No files matched your search

+14 -16
View File
@@ -21,12 +21,14 @@
*/
@import "CPButton.j"
@import "CPCompatibility.j"
@import "CPTableColumn.j"
@import "CPTableView.j"
@import "CPViewAnimation.j"
@import "CPTreeNode.j"
@global CPApp
@global document
CPOutlineViewColumnDidMoveNotification = @"CPOutlineViewColumnDidMoveNotification";
CPOutlineViewColumnDidResizeNotification = @"CPOutlineViewColumnDidResizeNotification";
@@ -2763,12 +2765,15 @@ function SHOULD_SELECT_ITEM(anOutlineView, anItem)
- (void)drawRect:(CGRect)aRect
{
/*
Every statement below works on the arrow's DOM element, which exists only where a DOM
is available.
*/
if (!CPDOMAvailable)
return;
if (CPDOMAvailable)
{
if (_arrowElement && _arrowElement.parentNode !== self._DOMElement)
self._DOMElement.appendChild(_arrowElement);
}
if (_arrowElement && _arrowElement.parentNode !== self._DOMElement)
self._DOMElement.appendChild(_arrowElement);
// If I am NOT the clone, I must check if my row is animating.
// If it is animating, the clone is drawing on top of me, so I should be invisible.
@@ -2780,18 +2785,14 @@ function SHOULD_SELECT_ITEM(anOutlineView, anItem)
var row = [outlineView rowForView:self];
if (row !== CPNotFound && [outlineView _isRowAnimatingDisclosure:row])
{
if (CPDOMAvailable)
{
_arrowElement.style.display = "none";
}
_arrowElement.style.display = "none";
return; // Suppress the real button
}
}
}
_arrowElement.style.display = "block";
_arrowElement.style.display = "block";
var isSelected = [self hasThemeState:CPThemeStateSelected],
isHighlighted = [self hasThemeState:CPThemeStateHighlighted],
isKeyWindow = [self hasThemeState:CPThemeStateKeyWindow],
@@ -2833,10 +2834,7 @@ function SHOULD_SELECT_ITEM(anOutlineView, anItem)
var svgString = '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M7 10L12 15L17 10H7Z" fill="' + colorCSS + '"/></svg>';
var b64 = window.btoa(svgString);
if (CPDOMAvailable)
{
_arrowElement.style.backgroundImage = "url('data:image/svg+xml;charset=utf-8;base64," + b64 + "')";
}
_arrowElement.style.backgroundImage = "url('data:image/svg+xml;charset=utf-8;base64," + b64 + "')";
}
}
+1
View File
@@ -40,6 +40,7 @@
@class CPClipView
@class CPUserDefaults
@class CPTableHeaderView
@class CPTableView
@class _CPTableColumnHeaderView
@class CPClipView
@class CPButton