More dashboard region changes for John.
<rdar://problem/
3817421> add getter for dashboard regions (debugging)
<rdar://problem/
3817417> NSScrollView need autoregions for dashboard
<rdar://problem/
3817388> should have short form form control regions
<rdar://problem/
3817477> visibility does not work with dashboard control regions
Reviewed by Hyatt.
* WebCore-combined.exp:
* WebCore.exp:
* khtml/css/cssparser.cpp:
(skipCommaInDashboardRegion):
(CSSParser::parseDashboardRegions):
* khtml/khtmlview.cpp:
(KHTMLView::updateDashboardRegions):
* khtml/rendering/render_object.cpp:
(RenderObject::setStyle):
(RenderObject::addDashboardRegions):
* khtml/xml/dom_docimpl.cpp:
(DocumentImpl::DocumentImpl):
(DocumentImpl::setDashboardRegions):
* khtml/xml/dom_docimpl.h:
(DOM::DocumentImpl::setDashboardRegionsDirty):
(DOM::DocumentImpl::dashboardRegionsDirty):
* kwq/KWQKHTMLPart.h:
* kwq/KWQKHTMLPart.mm:
(KWQKHTMLPart::paint):
(KWQKHTMLPart::dashboardRegionsDictionary):
(KWQKHTMLPart::dashboardRegionsChanged):
* kwq/WebCoreBridge.h:
* kwq/WebCoreBridge.mm:
(-[WebCoreBridge dashboardRegions]):
* kwq/WebDashboardRegion.h:
* kwq/WebDashboardRegion.m:
(-[WebDashboardRegion description]):
WebKit:
More dashboard region changes for John.
<rdar://problem/
3817421> add getter for dashboard regions (debugging)
<rdar://problem/
3817417> NSScrollView need autoregions for dashboard
Also KWQScrollBars
Reviewed by Hyatt.
* WebCoreSupport.subproj/WebBridge.m:
(-[WebBridge dashboardRegionsChanged:]):
* WebView.subproj/WebView.m:
(-[WebView _setInitiatedDrag:]):
(-[WebView _addScrollerDashboardRegions:from:]):
(-[WebView _addScrollerDashboardRegions:]):
(-[WebView _dashboardRegions]):
* WebView.subproj/WebViewPrivate.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@7712
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2004-09-28 Richard Williamson <rjw@apple.com>
+
+ More dashboard region changes for John.
+
+ <rdar://problem/3817421> add getter for dashboard regions (debugging)
+
+ <rdar://problem/3817417> NSScrollView need autoregions for dashboard
+
+ <rdar://problem/3817388> should have short form form control regions
+
+ <rdar://problem/3817477> visibility does not work with dashboard control regions
+
+ Reviewed by Hyatt.
+
+ * WebCore-combined.exp:
+ * WebCore.exp:
+ * khtml/css/cssparser.cpp:
+ (skipCommaInDashboardRegion):
+ (CSSParser::parseDashboardRegions):
+ * khtml/khtmlview.cpp:
+ (KHTMLView::updateDashboardRegions):
+ * khtml/rendering/render_object.cpp:
+ (RenderObject::setStyle):
+ (RenderObject::addDashboardRegions):
+ * khtml/xml/dom_docimpl.cpp:
+ (DocumentImpl::DocumentImpl):
+ (DocumentImpl::setDashboardRegions):
+ * khtml/xml/dom_docimpl.h:
+ (DOM::DocumentImpl::setDashboardRegionsDirty):
+ (DOM::DocumentImpl::dashboardRegionsDirty):
+ * kwq/KWQKHTMLPart.h:
+ * kwq/KWQKHTMLPart.mm:
+ (KWQKHTMLPart::paint):
+ (KWQKHTMLPart::dashboardRegionsDictionary):
+ (KWQKHTMLPart::dashboardRegionsChanged):
+ * kwq/WebCoreBridge.h:
+ * kwq/WebCoreBridge.mm:
+ (-[WebCoreBridge dashboardRegions]):
+ * kwq/WebDashboardRegion.h:
+ * kwq/WebDashboardRegion.m:
+ (-[WebDashboardRegion description]):
+
2004-09-28 John Sullivan <sullivan@apple.com>
Reviewed by Chris.
.objc_class_name_WebCoreSettings
.objc_class_name_WebCoreTextRendererFactory
.objc_class_name_WebCoreViewFactory
+.objc_class_name_WebDashboardRegion
_WebCoreElementDOMNodeKey
_WebCoreElementFrameKey
_WebCoreElementImageAltStringKey
.objc_class_name_WebCoreSettings
.objc_class_name_WebCoreTextRendererFactory
.objc_class_name_WebCoreViewFactory
+.objc_class_name_WebDashboardRegion
_WebCoreElementDOMNodeKey
_WebCoreElementFrameKey
_WebCoreElementImageAltStringKey
}
#define DASHBOARD_REGION_NUM_PARAMETERS 6
+#define DASHBOARD_REGION_SHORT_NUM_PARAMETERS 2
static Value *skipCommaInDashboardRegion (ValueList *args)
{
- if ( args->numValues == (DASHBOARD_REGION_NUM_PARAMETERS*2-1) ) {
+ if ( args->numValues == (DASHBOARD_REGION_NUM_PARAMETERS*2-1) ||
+ args->numValues == (DASHBOARD_REGION_SHORT_NUM_PARAMETERS*2-1)) {
Value *current = args->current();
if (current->unit == Value::Operator && current->iValue == ',' )
return args->next();
}
// Commas count as values, so allow:
- // dashbaord-region( label, type, t, r, b, l ) or dashbaord-region( label type t r b l )
- // dashbaord-region( label, type, t, r, b, l ) or dashbaord-region( label type t r b l )
+ // dashbaord-region(label, type, t, r, b, l) or dashbaord-region(label type t r b l)
+ // dashbaord-region(label, type, t, r, b, l) or dashbaord-region(label type t r b l)
+ // also allow
+ // dashbaord-region(label, type) or dashbaord-region(label type)
+ // dashbaord-region(label, type) or dashbaord-region(label type)
ValueList *args = value->function->args;
int numArgs = value->function->args->numValues;
- if (numArgs != DASHBOARD_REGION_NUM_PARAMETERS && numArgs != (DASHBOARD_REGION_NUM_PARAMETERS*2-1)) {
+ if ((numArgs != DASHBOARD_REGION_NUM_PARAMETERS && numArgs != (DASHBOARD_REGION_NUM_PARAMETERS*2-1)) &&
+ (numArgs != DASHBOARD_REGION_SHORT_NUM_PARAMETERS && numArgs != (DASHBOARD_REGION_SHORT_NUM_PARAMETERS*2-1))){
valid = false;
break;
}
region->m_geometryType = qString(arg->string);
- // Next four arguments must be offset numbers
- int i;
- for (i = 0; i < 4; i++) {
- arg = args->next();
- arg = skipCommaInDashboardRegion (args);
-
- valid = arg->id == CSS_VAL_AUTO || validUnit( arg, FLength, strict );
- if ( !valid )
- break;
-
+ if (numArgs == DASHBOARD_REGION_SHORT_NUM_PARAMETERS || numArgs == (DASHBOARD_REGION_SHORT_NUM_PARAMETERS*2-1)) {
CSSPrimitiveValueImpl *amount = arg->id == CSS_VAL_AUTO ?
new CSSPrimitiveValueImpl(CSS_VAL_AUTO) :
- new CSSPrimitiveValueImpl(arg->fValue, (CSSPrimitiveValue::UnitTypes) arg->unit );
+ new CSSPrimitiveValueImpl((double)0, (CSSPrimitiveValue::UnitTypes) arg->unit );
- if ( i == 0 )
- region->setTop( amount );
- else if ( i == 1 )
- region->setRight( amount );
- else if ( i == 2 )
- region->setBottom( amount );
- else
- region->setLeft( amount );
+ region->setTop( amount );
+ region->setRight( amount );
+ region->setBottom( amount );
+ region->setLeft( amount );
+ }
+ else {
+ // Next four arguments must be offset numbers
+ int i;
+ for (i = 0; i < 4; i++) {
+ arg = args->next();
+ arg = skipCommaInDashboardRegion (args);
+
+ valid = arg->id == CSS_VAL_AUTO || validUnit( arg, FLength, strict );
+ if ( !valid )
+ break;
+
+ CSSPrimitiveValueImpl *amount = arg->id == CSS_VAL_AUTO ?
+ new CSSPrimitiveValueImpl(CSS_VAL_AUTO) :
+ new CSSPrimitiveValueImpl(arg->fValue, (CSSPrimitiveValue::UnitTypes) arg->unit );
+
+ if ( i == 0 )
+ region->setTop( amount );
+ else if ( i == 1 )
+ region->setRight( amount );
+ else if ( i == 2 )
+ region->setBottom( amount );
+ else
+ region->setLeft( amount );
+ }
}
value = valueList->next();
QValueList<DashboardRegionValue> currentRegions = document->dashboardRegions();
if (!(newRegions == currentRegions)) {
document->setDashboardRegions(newRegions);
- KWQ(m_part)->dashboardRegionsChanged(newRegions);
+ KWQ(m_part)->dashboardRegionsChanged();
}
}
}
// If our z-index changes value or our visibility changes,
// we need to dirty our stacking context's z-order list.
if (style) {
+#if APPLE_CHANGES
+ if (m_style->visibility() != style->visibility() ||
+ m_style->zIndex() != style->zIndex() ||
+ m_style->hasAutoZIndex() != style->hasAutoZIndex())
+ document()->setDashboardRegionsDirty(true);
+#endif
+
if ((m_style->hasAutoZIndex() != style->hasAutoZIndex() ||
m_style->zIndex() != style->zIndex() ||
m_style->visibility() != style->visibility()) && layer()) {
void RenderObject::addDashboardRegions (QValueList<DashboardRegionValue>& regions)
{
// Convert the style regions to absolute coordinates.
+ if (style()->visibility() != VISIBLE)
+ return;
+
QValueList<StyleDashboardRegion> styleRegions = style()->dashboardRegions();
if (styleRegions.count() > 0) {
uint i, count = styleRegions.count();
, m_passwordFields(0), m_secureForms(0)
, m_decoder(0), m_createRenderers(true)
, m_hasDashboardRegions(false)
+ , m_dashboardRegionsDirty(false)
#endif
{
document->doc = this;
void DocumentImpl::setDashboardRegions (const QValueList<DashboardRegionValue>& regions)
{
m_dashboardRegions = regions;
+ setDashboardRegionsDirty (false);
}
#endif
void setDecoder(khtml::Decoder *);
khtml::Decoder *decoder() const { return m_decoder; }
+ void setDashboardRegionsDirty(bool f) { m_dashboardRegionsDirty = f; }
+ bool dashboardRegionsDirty() const { return m_dashboardRegionsDirty; }
bool hasDashboardRegions () const { return m_hasDashboardRegions; }
void setHasDashboardRegions (bool f) { m_hasDashboardRegions = f; }
const QValueList<khtml::DashboardRegionValue> & dashboardRegions() const;
QValueList<khtml::DashboardRegionValue> m_dashboardRegions;
bool m_hasDashboardRegions;
+ bool m_dashboardRegionsDirty;
#endif
};
void didFirstLayout();
- void dashboardRegionsChanged(const QValueList<khtml::DashboardRegionValue> ®ions);
+ NSMutableDictionary *dashboardRegionsDictionary();
+ void dashboardRegionsChanged();
private:
virtual void khtmlMousePressEvent(khtml::MousePressEvent *);
// _elementToDraw is used to draw only one element
RenderObject *eltRenderer = (_elementToDraw != 0) ? _elementToDraw.handle()->renderer() : 0;
renderer()->layer()->paint(p, rect, _drawSelectionOnly, eltRenderer);
+
+#if APPLE_CHANGES
+ // Regions may have changed as a result of the visibility/z-index of element changing.
+ if (renderer()->document()->dashboardRegionsDirty()){
+ renderer()->canvas()->view()->updateDashboardRegions();
+ }
+#endif
} else {
ERROR("called KWQKHTMLPart::paint with nil renderer");
}
[_bridge didFirstLayout];
}
-void KWQKHTMLPart::dashboardRegionsChanged(const QValueList<DashboardRegionValue>& regions)
+NSMutableDictionary *KWQKHTMLPart::dashboardRegionsDictionary()
{
+ DocumentImpl *doc = xmlDocImpl();
+ if (!doc) {
+ return nil;
+ }
+
+ const QValueList<DashboardRegionValue> regions = doc->dashboardRegions();
uint i, count = regions.count();
// Convert the QValueList<DashboardRegionValue> into a NSDictionary of WebDashboardRegions
- NSMutableDictionary *webRegions = [[NSMutableDictionary alloc] initWithCapacity:count];
+ NSMutableDictionary *webRegions = [[[NSMutableDictionary alloc] initWithCapacity:count] autorelease];
for (i = 0; i < count; i++) {
DashboardRegionValue region = regions[i];
NSRect clip;
[regionValues addObject:webRegion];
}
+ return webRegions;
+}
+
+void KWQKHTMLPart::dashboardRegionsChanged()
+{
+ NSMutableDictionary *webRegions = dashboardRegionsDictionary();
[_bridge dashboardRegionsChanged:webRegions];
}
- (BOOL)tryDHTMLCopy;
- (BOOL)tryDHTMLPaste;
+- (NSMutableDictionary *)dashboardRegions;
+
@end
// The WebCoreBridge protocol contains methods for use by the WebCore side of the bridge.
- (void)didFirstLayout;
-- (void)dashboardRegionsChanged:(NSDictionary *)regions;
+- (void)dashboardRegionsChanged:(NSMutableDictionary *)regions;
@end
return [DOMRange _rangeWithImpl:makeRange(previous, next).handle()];
}
+- (NSMutableDictionary *)dashboardRegions
+{
+ return _part->dashboardRegionsDictionary();
+}
+
@end
@implementation WebCoreBridge (WebCoreBridgePrivate)
typedef enum {
WebDashboardRegionTypeNone,
WebDashboardRegionTypeCircle,
- WebDashboardRegionTypeRectangle
+ WebDashboardRegionTypeRectangle,
+ WebDashboardRegionTypeScrollerRectangle
} WebDashboardRegionType;
@interface WebDashboardRegion : NSObject <NSCopying>
type == WebDashboardRegionTypeNone ? "None" :
(type == WebDashboardRegionTypeCircle ? "Circle" :
(type == WebDashboardRegionTypeRectangle ? "Rectangle" :
- "Unknown"))];
+ (type == WebDashboardRegionTypeScrollerRectangle ? "ScrollerRectangle" :
+ "Unknown")))];
}
@end
\ No newline at end of file
+2004-09-28 Richard Williamson <rjw@apple.com>
+
+ <rdar://problem/3817421> add getter for dashboard regions (debugging)
+
+ <rdar://problem/3817417> NSScrollView need autoregions for dashboard
+ Also KWQScrollBars
+
+ Reviewed by Hyatt.
+
+ * WebCoreSupport.subproj/WebBridge.m:
+ (-[WebBridge dashboardRegionsChanged:]):
+ * WebView.subproj/WebView.m:
+ (-[WebView _setInitiatedDrag:]):
+ (-[WebView _addScrollerDashboardRegions:from:]):
+ (-[WebView _addScrollerDashboardRegions:]):
+ (-[WebView _dashboardRegions]):
+ * WebView.subproj/WebViewPrivate.h:
+
2004-09-27 John Sullivan <sullivan@apple.com>
- fixed <rdar://problem/3814705> 8A266: Safari authentication dialog "remember password" text should match Mail
[[wv _frameLoadDelegateForwarder] webView:wv didFirstLayoutInFrame:_frame];
}
-- (void)dashboardRegionsChanged:(NSDictionary *)regions
+- (void)dashboardRegionsChanged:(NSMutableDictionary *)regions
{
WebView *wv = [_frame webView];
id wd = [wv UIDelegate];
- if ([wd respondsToSelector: @selector(webView:dashboardRegionsChanged:)])
+
+ [wv _addScrollerDashboardRegions:regions];
+
+ if ([wd respondsToSelector: @selector(webView:dashboardRegionsChanged:)]) {
[wd webView:wv dashboardRegionsChanged:regions];
+ }
}
// This method exists to hold localizable strings for action names for the Undo menu item. It contains
#import <WebKit/WebBaseNetscapePluginView.h>
#import <WebKit/WebBridge.h>
#import <WebKit/WebControllerSets.h>
+#import <WebKit/WebDashboardRegion.h>
#import <WebKit/WebDataProtocol.h>
#import <WebKit/WebDataSourcePrivate.h>
#import <WebKit/WebDefaultEditingDelegate.h>
_private->initiatedDrag = initiatedDrag;
}
+
+- (void)_addScrollerDashboardRegions:(NSMutableDictionary *)regions from:(NSArray *)views
+{
+ // Add scroller regions for NSScroller and KWQScrollBar
+ int i, count = [views count];
+
+ for (i = 0; i < count; i++) {
+ NSView *aView = [views objectAtIndex:i];
+
+ if ([aView isKindOfClass:[NSScroller class]] ||
+ [aView isKindOfClass:NSClassFromString (@"KWQScrollBar")]) {
+ NSRect bounds = [aView bounds];
+ NSRect adjustedBounds;
+ adjustedBounds.origin = [self convertPoint:bounds.origin fromView:aView];
+ adjustedBounds.origin.y = [self bounds].size.height - adjustedBounds.origin.y;
+
+ // AppKit has horrible hack of placing absent scrollers at -100,-100
+ if (adjustedBounds.origin.y == -100)
+ continue;
+ adjustedBounds.size = bounds.size;
+ NSRect clip = [aView visibleRect];
+ NSRect adjustedClip;
+ adjustedClip.origin = [self convertPoint:clip.origin fromView:aView];
+ adjustedClip.origin.y = [self bounds].size.height - adjustedClip.origin.y;
+ adjustedClip.size = clip.size;
+ WebDashboardRegion *aRegion =
+ [[[WebDashboardRegion alloc] initWithRect:adjustedBounds
+ clip:adjustedClip type:WebDashboardRegionTypeScrollerRectangle] autorelease];
+ NSMutableArray *scrollerRegions;
+ scrollerRegions = [regions objectForKey:@"scroller"];
+ if (!scrollerRegions) {
+ scrollerRegions = [NSMutableArray array];
+ [regions setObject:scrollerRegions forKey:@"scroller"];
+ }
+ [scrollerRegions addObject:aRegion];
+ }
+ [self _addScrollerDashboardRegions:regions from:[aView subviews]];
+ }
+}
+
+- (void)_addScrollerDashboardRegions:(NSMutableDictionary *)regions
+{
+ [self _addScrollerDashboardRegions:regions from:[self subviews]];
+}
+
+- (NSDictionary *)_dashboardRegions
+{
+ // Only return regions from main frame.
+ NSMutableDictionary *regions = [[[self mainFrame] _bridge] dashboardRegions];
+ [self _addScrollerDashboardRegions:regions];
+ return regions;
+}
+
@end
- (void)_writeImageElement:(NSDictionary *)element withPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard;
- (void)_writeLinkElement:(NSDictionary *)element withPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard;
+- (void)_addScrollerDashboardRegions:(NSMutableDictionary *)regions;
+- (NSDictionary *)_dashboardRegions;
+
@end
@interface WebView (WebViewPrintingPrivate)