Changeset 13639 in webkit


Ignore:
Timestamp:
Apr 2, 2006 6:11:28 PM (18 years ago)
Author:
darin
Message:

Reviewed by Adele.

  • some cleanup to how we parse user agent style sheets
  • css/CSSValueKeywords.in: Added -webkit-focus-ring-color.
  • css/cssstyleselector.cpp: (WebCore::parseUASheet): Parse an array of chars instead of UTF-16. Cuts the size of the style sheet in half. (WebCore::CSSStyleSelector::applyProperty): Allow negative value for outline-offset. Changed shadow parsing to use getColorFromPrimitiveValue instead of repeating the same logic. (WebCore::CSSStyleSelector::getColorFromPrimitiveValue): Added a case for the focus ring color.
  • rendering/render_style.h: (WebCore::RenderStyle::setOutlineOffset): Changed to allow negative values.
  • css/html4.css: Removed a lot of excess spaces. Changed color of focus to -webkit-focus-ring-color. Changed width of focus to 5px. Added an outline-offset for <input type=text> of -2px.
  • css/cssparser.cpp: (WebCore::CSSParser::parseValue): Added focus ring color as an outline color all the time, and as any other color when not in strict mode. I'm confused about what's best for this whole strict mode policy, and I may need advice on Hyatt to perfect this one later. (WebCore::CSSParser::parseColorFromValue): Removed code to pin r, g, and b because the functions in platform already take care of that. Kept the pinning of a, though because that's done in floating point before converting to an integer. (WebCore::CSSParser::parseShadow): Allow focus ring color when not in strict mode.
  • bridge/mac/FrameMac.h: Eliminated the virtual detachFromView function.
  • bridge/mac/FrameMac.mm: (WebCore::FrameMac::FrameMac): Eliminated code to maintain the frame instances list. (WebCore::FrameMac::~FrameMac): Ditto. (WebCore::Frame::setNeedsReapplyStyles): Added.
  • bridge/mac/WebCoreSettings.mm: (-[WebCoreSettings _updateAllViews]):
  • platform/mac/WebCoreTextRendererFactory.mm: (-[WebCoreTextRendererFactory clearCaches]): Changed to call the new Page::setNeedsReapplyStylesForSettingsChange instead of using the obsolete Frame::instances.
  • page/Frame.h: Removed instances, mutableInstances, and detachFromView.
  • page/Frame.cpp: Ditto.
  • page/FrameTree.cpp: (WebCore::FrameTree::~FrameTree): Call setView(0) instead of detachFromView(). (WebCore::FrameTree::removeChild): Ditto.
  • page/Page.h:
  • page/Page.cpp: (WebCore::Page::init): Added a set of pages instead of a page count. Also register a function for when the focus ring color changes the first time this is called. (WebCore::Page::~Page): Call setView(0) instead of detachFromView. Also update to manager the set of pages. (WebCore::Page::setNeedsReapplyStyles): Call setNeedsReapplyStyles on all frames. (WebCore::Page::setNeedsReapplyStylesForSettingsChange): Call setNeedsReapplyStyles on all frames with the passed-in settings.
  • css/make-css-file-arrays.pl: Changed to run the C preprocessor on the input files and to generate an array of char instead of unsigned short.
  • platform/PlatformString.h: Added a constructor that takes a char* and a length.
  • platform/String.cpp: (WebCore::String::String): Ditto.
  • WebCore.xcodeproj/project.pbxproj: Just some tweaks; adding in a few files like the user agent style sheets.
  • platform/Color.h: Removed all use of DeprecatedString. Cleaned up a bit. Added focusRingColor and setFocusRingColorChangeFunction.
  • platform/Color.cpp: (WebCore::makeRGB): Rewrote using max and min. (WebCore::makeRGBA): Ditto. (WebCore::parseHexColor): Cleaned up a bit; changed partway to String instead of DeprecatedString. (WebCore::Color::Color): Changed to use String and to call setNamedColor to save code. (WebCore::Color::setNamedColor): Changed to use String in the interface.
  • platform/mac/ColorMac.mm: (WebCore::observeTheme): Added. Function used to start up the observer. (WebCore::setFocusRingColorChangeFunction): Added. Used to get a call back so we can update all the views when the color changes (including recomputing style to get the color change in). (WebCore::setFocusRingColorChangeFunction): Added. Returns one of the two focus ring colors. Both of these match what AppKit uses -- neither matches what we used to have in the html4.css file. (+[WebCoreControlTintObserver controlTintDidChange]): Added. Used to update when the appearance is changed from blue to graphite and back. We keep a global so we don't have to call over to AppKit every time; that's probably overkill but we need the obsever for the color change function anyway.
Location:
trunk/WebCore
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r13638 r13639  
     12006-04-02  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Adele.
     4
     5        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8123
     6          focus ring on new text field doesn't look like the old one
     7
     8        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7685
     9          Focus ring color should change to match graphite when system theme is graphite
     10
     11        - some cleanup to how we parse user agent style sheets
     12
     13        * css/CSSValueKeywords.in: Added -webkit-focus-ring-color.
     14
     15        * css/cssstyleselector.cpp:
     16        (WebCore::parseUASheet): Parse an array of chars instead of UTF-16.
     17        Cuts the size of the style sheet in half.
     18        (WebCore::CSSStyleSelector::applyProperty): Allow negative value for
     19        outline-offset. Changed shadow parsing to use getColorFromPrimitiveValue
     20        instead of repeating the same logic.
     21        (WebCore::CSSStyleSelector::getColorFromPrimitiveValue): Added a case
     22        for the focus ring color.
     23        * rendering/render_style.h: (WebCore::RenderStyle::setOutlineOffset):
     24        Changed to allow negative values.
     25
     26        * css/html4.css: Removed a lot of excess spaces. Changed color of focus
     27        to -webkit-focus-ring-color. Changed width of focus to 5px.
     28        Added an outline-offset for <input type=text> of -2px.
     29
     30        * css/cssparser.cpp:
     31        (WebCore::CSSParser::parseValue): Added focus ring color as an outline color all
     32        the time, and as any other color when not in strict mode. I'm confused about what's
     33        best for this whole strict mode policy, and I may need advice on Hyatt to perfect
     34        this one later.
     35        (WebCore::CSSParser::parseColorFromValue): Removed code to pin r, g, and b because
     36        the functions in platform already take care of that. Kept the pinning of a, though
     37        because that's done in floating point before converting to an integer.
     38        (WebCore::CSSParser::parseShadow): Allow focus ring color when not in strict mode.
     39
     40        * bridge/mac/FrameMac.h: Eliminated the virtual detachFromView function.
     41        * bridge/mac/FrameMac.mm:
     42        (WebCore::FrameMac::FrameMac): Eliminated code to maintain the frame instances list.
     43        (WebCore::FrameMac::~FrameMac): Ditto.
     44        (WebCore::Frame::setNeedsReapplyStyles): Added.
     45
     46        * bridge/mac/WebCoreSettings.mm: (-[WebCoreSettings _updateAllViews]):
     47        * platform/mac/WebCoreTextRendererFactory.mm:
     48        (-[WebCoreTextRendererFactory clearCaches]):
     49        Changed to call the new Page::setNeedsReapplyStylesForSettingsChange instead of using the
     50        obsolete Frame::instances.
     51
     52        * page/Frame.h: Removed instances, mutableInstances, and detachFromView.
     53        * page/Frame.cpp: Ditto.
     54
     55        * page/FrameTree.cpp:
     56        (WebCore::FrameTree::~FrameTree): Call setView(0) instead of detachFromView().
     57        (WebCore::FrameTree::removeChild): Ditto.
     58
     59        * page/Page.h:
     60        * page/Page.cpp:
     61        (WebCore::Page::init): Added a set of pages instead of a page count. Also
     62        register a function for when the focus ring color changes the first time this
     63        is called.
     64        (WebCore::Page::~Page): Call setView(0) instead of detachFromView. Also update
     65        to manager the set of pages.
     66        (WebCore::Page::setNeedsReapplyStyles): Call setNeedsReapplyStyles on all frames.
     67        (WebCore::Page::setNeedsReapplyStylesForSettingsChange): Call setNeedsReapplyStyles
     68        on all frames with the passed-in settings.
     69
     70        * css/make-css-file-arrays.pl: Changed to run the C preprocessor on the
     71        input files and to generate an array of char instead of unsigned short.
     72
     73        * platform/PlatformString.h: Added a constructor that takes a char* and
     74        a length.
     75        * platform/String.cpp: (WebCore::String::String): Ditto.
     76
     77        * WebCore.xcodeproj/project.pbxproj: Just some tweaks; adding in a few files like
     78        the user agent style sheets.
     79
     80        * platform/Color.h: Removed all use of DeprecatedString. Cleaned up a bit.
     81        Added focusRingColor and setFocusRingColorChangeFunction.
     82        * platform/Color.cpp:
     83        (WebCore::makeRGB): Rewrote using max and min.
     84        (WebCore::makeRGBA): Ditto.
     85        (WebCore::parseHexColor): Cleaned up a bit; changed partway to String instead of
     86        DeprecatedString.
     87        (WebCore::Color::Color): Changed to use String and to call setNamedColor to save code.
     88        (WebCore::Color::setNamedColor): Changed to use String in the interface.
     89
     90        * platform/mac/ColorMac.mm:
     91        (WebCore::observeTheme): Added. Function used to start up the observer.
     92        (WebCore::setFocusRingColorChangeFunction): Added. Used to get a call back so we can
     93        update all the views when the color changes (including recomputing style to get the
     94        color change in).
     95        (WebCore::setFocusRingColorChangeFunction): Added. Returns one of the two focus
     96        ring colors. Both of these match what AppKit uses -- neither matches what we used
     97        to have in the html4.css file.
     98        (+[WebCoreControlTintObserver controlTintDidChange]): Added. Used to update when
     99        the appearance is changed from blue to graphite and back. We keep a global so we
     100        don't have to call over to AppKit every time; that's probably overkill but we need
     101        the obsever for the color change function anyway.
     102
    11032006-04-02  Mitz Pettel  <opendarwin.org@mitzpettel.com>
    2104
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r13634 r13639  
    290290                93C841F809CE855C00DFF5E5 /* DOMImplementationFront.h in Headers */ = {isa = PBXBuildFile; fileRef = 93C841F709CE855C00DFF5E5 /* DOMImplementationFront.h */; };
    291291                93C841FF09CE858300DFF5E5 /* DOMImplementationFront.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93C841FE09CE858300DFF5E5 /* DOMImplementationFront.cpp */; };
     292                93CA4CA409DF93FA00DF8677 /* CSSStyleDeclaration.idl in Resources */ = {isa = PBXBuildFile; fileRef = 93CA4C9709DF93FA00DF8677 /* CSSStyleDeclaration.idl */; };
     293                93CA4CA509DF93FA00DF8677 /* CSSStyleSheet.idl in Resources */ = {isa = PBXBuildFile; fileRef = 93CA4C9809DF93FA00DF8677 /* CSSStyleSheet.idl */; };
     294                93CA4CA609DF93FA00DF8677 /* html4.css in Resources */ = {isa = PBXBuildFile; fileRef = 93CA4C9909DF93FA00DF8677 /* html4.css */; };
     295                93CA4CA709DF93FA00DF8677 /* make-css-file-arrays.pl in Resources */ = {isa = PBXBuildFile; fileRef = 93CA4C9A09DF93FA00DF8677 /* make-css-file-arrays.pl */; };
     296                93CA4CA809DF93FA00DF8677 /* makeprop in Resources */ = {isa = PBXBuildFile; fileRef = 93CA4C9B09DF93FA00DF8677 /* makeprop */; };
     297                93CA4CA909DF93FA00DF8677 /* maketokenizer in Resources */ = {isa = PBXBuildFile; fileRef = 93CA4C9C09DF93FA00DF8677 /* maketokenizer */; };
     298                93CA4CAA09DF93FA00DF8677 /* makevalues in Resources */ = {isa = PBXBuildFile; fileRef = 93CA4C9D09DF93FA00DF8677 /* makevalues */; };
     299                93CA4CAB09DF93FA00DF8677 /* MediaList.idl in Resources */ = {isa = PBXBuildFile; fileRef = 93CA4C9E09DF93FA00DF8677 /* MediaList.idl */; };
     300                93CA4CAC09DF93FA00DF8677 /* quirks.css in Resources */ = {isa = PBXBuildFile; fileRef = 93CA4C9F09DF93FA00DF8677 /* quirks.css */; };
     301                93CA4CAD09DF93FA00DF8677 /* StyleSheet.idl in Resources */ = {isa = PBXBuildFile; fileRef = 93CA4CA009DF93FA00DF8677 /* StyleSheet.idl */; };
     302                93CA4CAE09DF93FA00DF8677 /* StyleSheetList.idl in Resources */ = {isa = PBXBuildFile; fileRef = 93CA4CA109DF93FA00DF8677 /* StyleSheetList.idl */; };
     303                93CA4CAF09DF93FA00DF8677 /* svg.css in Resources */ = {isa = PBXBuildFile; fileRef = 93CA4CA209DF93FA00DF8677 /* svg.css */; };
     304                93CA4CB009DF93FA00DF8677 /* tokenizer.flex in Resources */ = {isa = PBXBuildFile; fileRef = 93CA4CA309DF93FA00DF8677 /* tokenizer.flex */; };
    292305                93CD4FDE0995F9EA007ECC97 /* AtomicString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93CD4FD70995F9EA007ECC97 /* AtomicString.cpp */; };
    293306                93CD4FDF0995F9EA007ECC97 /* AtomicString.h in Headers */ = {isa = PBXBuildFile; fileRef = 93CD4FD80995F9EA007ECC97 /* AtomicString.h */; };
     
    12581271                656580EE09D12B20000E61D7 /* CSSPropertyNames.gperf */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = CSSPropertyNames.gperf; sourceTree = "<group>"; };
    12591272                656580EF09D12B20000E61D7 /* CSSPropertyNames.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSPropertyNames.h; sourceTree = "<group>"; };
    1260                 656580F009D12B20000E61D7 /* CSSPropertyNames.in */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = CSSPropertyNames.in; sourceTree = "<group>"; };
    12611273                656580F109D12B20000E61D7 /* CSSPropertyNames.strip */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = CSSPropertyNames.strip; sourceTree = "<group>"; };
    12621274                6565811C09D12DB2000E61D7 /* DocTypeStrings.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = DocTypeStrings.cpp; sourceTree = "<group>"; };
     
    12651277                6565814709D13043000E61D7 /* CSSValueKeywords.gperf */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = CSSValueKeywords.gperf; sourceTree = "<group>"; };
    12661278                6565814809D13043000E61D7 /* CSSValueKeywords.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSValueKeywords.h; sourceTree = "<group>"; };
    1267                 6565814909D13043000E61D7 /* CSSValueKeywords.in */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = CSSValueKeywords.in; sourceTree = "<group>"; };
    12681279                6565814A09D13043000E61D7 /* CSSValueKeywords.strip */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = CSSValueKeywords.strip; sourceTree = "<group>"; };
    12691280                6565814B09D13043000E61D7 /* HTMLEntityNames.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = HTMLEntityNames.c; sourceTree = "<group>"; };
     
    15381549                93C841F709CE855C00DFF5E5 /* DOMImplementationFront.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DOMImplementationFront.h; path = bindings/objc/DOMImplementationFront.h; sourceTree = "<group>"; };
    15391550                93C841FE09CE858300DFF5E5 /* DOMImplementationFront.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DOMImplementationFront.cpp; path = bindings/objc/DOMImplementationFront.cpp; sourceTree = "<group>"; };
     1551                93CA4C9709DF93FA00DF8677 /* CSSStyleDeclaration.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CSSStyleDeclaration.idl; sourceTree = "<group>"; };
     1552                93CA4C9809DF93FA00DF8677 /* CSSStyleSheet.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CSSStyleSheet.idl; sourceTree = "<group>"; };
     1553                93CA4C9909DF93FA00DF8677 /* html4.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = html4.css; sourceTree = "<group>"; };
     1554                93CA4C9A09DF93FA00DF8677 /* make-css-file-arrays.pl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = "make-css-file-arrays.pl"; sourceTree = "<group>"; };
     1555                93CA4C9B09DF93FA00DF8677 /* makeprop */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = makeprop; sourceTree = "<group>"; };
     1556                93CA4C9C09DF93FA00DF8677 /* maketokenizer */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = maketokenizer; sourceTree = "<group>"; };
     1557                93CA4C9D09DF93FA00DF8677 /* makevalues */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = makevalues; sourceTree = "<group>"; };
     1558                93CA4C9E09DF93FA00DF8677 /* MediaList.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MediaList.idl; sourceTree = "<group>"; };
     1559                93CA4C9F09DF93FA00DF8677 /* quirks.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = quirks.css; sourceTree = "<group>"; };
     1560                93CA4CA009DF93FA00DF8677 /* StyleSheet.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = StyleSheet.idl; sourceTree = "<group>"; };
     1561                93CA4CA109DF93FA00DF8677 /* StyleSheetList.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = StyleSheetList.idl; sourceTree = "<group>"; };
     1562                93CA4CA209DF93FA00DF8677 /* svg.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = svg.css; sourceTree = "<group>"; };
     1563                93CA4CA309DF93FA00DF8677 /* tokenizer.flex */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tokenizer.flex; sourceTree = "<group>"; };
    15401564                93CCF7D4033BD43C008635CE /* KWQFileButton.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KWQFileButton.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    15411565                93CCF7D5033BD43C008635CE /* KWQFileButton.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KWQFileButton.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
     
    26062630                                656580EE09D12B20000E61D7 /* CSSPropertyNames.gperf */,
    26072631                                656580EF09D12B20000E61D7 /* CSSPropertyNames.h */,
    2608                                 656580F009D12B20000E61D7 /* CSSPropertyNames.in */,
    26092632                                656580F109D12B20000E61D7 /* CSSPropertyNames.strip */,
    26102633                                6565814609D13043000E61D7 /* CSSValueKeywords.c */,
    26112634                                6565814709D13043000E61D7 /* CSSValueKeywords.gperf */,
    26122635                                6565814809D13043000E61D7 /* CSSValueKeywords.h */,
    2613                                 6565814909D13043000E61D7 /* CSSValueKeywords.in */,
    26142636                                6565814A09D13043000E61D7 /* CSSValueKeywords.strip */,
    26152637                                6565811C09D12DB2000E61D7 /* DocTypeStrings.cpp */,
     
    26792701                                656581AE09D14EE6000E61D7 /* UserAgentStyleSheets.h */,
    26802702                                656581AF09D14EE6000E61D7 /* UserAgentStyleSheetsData.cpp */,
    2681                                 6565829209D157FA000E61D7 /* WebCore */,
    26822703                                656581EA09D1508D000E61D7 /* XLinkNames.cpp */,
    26832704                                656581EB09D1508D000E61D7 /* XLinkNames.h */,
    26842705                        );
    26852706                        name = "Derived Sources";
    2686                         path = DerivedSources/WebCore;
    2687                         sourceTree = BUILT_PRODUCTS_DIR;
    2688                 };
    2689                 6565829209D157FA000E61D7 /* WebCore */ = {
    2690                         isa = PBXGroup;
    2691                         children = (
    2692                         );
    2693                         name = WebCore;
    26942707                        path = DerivedSources/WebCore;
    26952708                        sourceTree = BUILT_PRODUCTS_DIR;
     
    31733186                        sourceTree = "<group>";
    31743187                };
    3175                 A88427FC093081AD00B6D461 /* KDOM Support */ = {
     3188                A8C0F6DC089701F100BA5114 /* WebCore+SVG */ = {
    31763189                        isa = PBXGroup;
    31773190                        children = (
     
    31823195                                A884283809308C1C00B6D461 /* SVGNamesWrapper.cpp */,
    31833196                                A8C32D96093D8EA4000B9CAC /* XLinkNamesWrapper.cpp */,
    3184                         );
    3185                         name = "KDOM Support";
    3186                         sourceTree = "<group>";
    3187                 };
    3188                 A8C0F6DC089701F100BA5114 /* WebCore+SVG */ = {
    3189                         isa = PBXGroup;
    3190                         children = (
    3191                                 A88427FC093081AD00B6D461 /* KDOM Support */,
    31923197                        );
    31933198                        path = "WebCore+SVG";
     
    39053910                                BCEA477A097CAAC80094C9E4 /* css_base.cpp */,
    39063911                                BCEA477B097CAAC80094C9E4 /* css_base.h */,
    3907                                 BCEA477C097CAAC80094C9E4 /* CSSComputedStyleDeclaration.cpp */,
    3908                                 BCEA477D097CAAC80094C9E4 /* CSSComputedStyleDeclaration.h */,
    3909                                 BCEA477E097CAAC80094C9E4 /* CSSGrammar.y */,
    39103912                                BCEA477F097CAAC80094C9E4 /* css_ruleimpl.cpp */,
    39113913                                BCEA4780097CAAC80094C9E4 /* css_ruleimpl.h */,
     
    39143916                                BCEA4783097CAAC80094C9E4 /* css_valueimpl.cpp */,
    39153917                                BCEA4784097CAAC80094C9E4 /* css_valueimpl.h */,
     3918                                BCEA477C097CAAC80094C9E4 /* CSSComputedStyleDeclaration.cpp */,
     3919                                BCEA477D097CAAC80094C9E4 /* CSSComputedStyleDeclaration.h */,
     3920                                BCEA477E097CAAC80094C9E4 /* CSSGrammar.y */,
    39163921                                BCEA4785097CAAC80094C9E4 /* csshelper.cpp */,
    39173922                                BCEA4786097CAAC80094C9E4 /* csshelper.h */,
     
    39193924                                BCEA4788097CAAC80094C9E4 /* cssparser.h */,
    39203925                                BCEA4789097CAAC80094C9E4 /* CSSPropertyNames.in */,
     3926                                93CA4C9709DF93FA00DF8677 /* CSSStyleDeclaration.idl */,
    39213927                                BCEA478A097CAAC80094C9E4 /* cssstyleselector.cpp */,
    39223928                                BCEA478B097CAAC80094C9E4 /* cssstyleselector.h */,
     3929                                93CA4C9809DF93FA00DF8677 /* CSSStyleSheet.idl */,
    39233930                                BCEA478C097CAAC80094C9E4 /* CSSValueKeywords.in */,
     3931                                93CA4C9909DF93FA00DF8677 /* html4.css */,
    39243932                                935C476009AC4CD100A6AAB4 /* Length.h */,
     3933                                93CA4C9A09DF93FA00DF8677 /* make-css-file-arrays.pl */,
     3934                                93CA4C9B09DF93FA00DF8677 /* makeprop */,
     3935                                93CA4C9C09DF93FA00DF8677 /* maketokenizer */,
     3936                                93CA4C9D09DF93FA00DF8677 /* makevalues */,
     3937                                93CA4C9E09DF93FA00DF8677 /* MediaList.idl */,
     3938                                93CA4C9F09DF93FA00DF8677 /* quirks.css */,
     3939                                93CA4CA009DF93FA00DF8677 /* StyleSheet.idl */,
     3940                                93CA4CA109DF93FA00DF8677 /* StyleSheetList.idl */,
     3941                                93CA4CA209DF93FA00DF8677 /* svg.css */,
     3942                                93CA4CA309DF93FA00DF8677 /* tokenizer.flex */,
    39253943                        );
    39263944                        path = css;
     
    49574975                                930CAB9709C49FAA00229C04 /* CodeGeneratorJS.pm in Resources */,
    49584976                                936DD03B09CEAC270056AE8C /* Range.idl in Resources */,
     4977                                93CA4CA409DF93FA00DF8677 /* CSSStyleDeclaration.idl in Resources */,
     4978                                93CA4CA509DF93FA00DF8677 /* CSSStyleSheet.idl in Resources */,
     4979                                93CA4CA609DF93FA00DF8677 /* html4.css in Resources */,
     4980                                93CA4CA709DF93FA00DF8677 /* make-css-file-arrays.pl in Resources */,
     4981                                93CA4CA809DF93FA00DF8677 /* makeprop in Resources */,
     4982                                93CA4CA909DF93FA00DF8677 /* maketokenizer in Resources */,
     4983                                93CA4CAA09DF93FA00DF8677 /* makevalues in Resources */,
     4984                                93CA4CAB09DF93FA00DF8677 /* MediaList.idl in Resources */,
     4985                                93CA4CAC09DF93FA00DF8677 /* quirks.css in Resources */,
     4986                                93CA4CAD09DF93FA00DF8677 /* StyleSheet.idl in Resources */,
     4987                                93CA4CAE09DF93FA00DF8677 /* StyleSheetList.idl in Resources */,
     4988                                93CA4CAF09DF93FA00DF8677 /* svg.css in Resources */,
     4989                                93CA4CB009DF93FA00DF8677 /* tokenizer.flex in Resources */,
    49594990                        );
    49604991                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r13555 r13639  
    125125  } elsif ($module eq "core") {
    126126    return "#include \"kjs_dom.h\"\n\n";
     127  } elsif ($module eq "css") {
     128    return "#include \"kjs_css.h\"\n\n";
    127129  } elsif ($module eq "html") {
    128130    return "#include \"kjs_html.h\"\n\n";
     
    154156  } elsif ($type eq "CSSStyleSheet" or $type eq "StyleSheet") {
    155157    $implIncludes{"css_stylesheetimpl.h"} = 1;
     158  } elsif ($type eq "CSSPrimitiveValue" or $type eq "Counter" or $type eq "Rect" or $type eq "RGBColor") {
     159    $implIncludes{"css_valueimpl.h"} = 1;
    156160  } elsif ($type eq "HTMLDocument") {
    157161    $implIncludes{"HTMLDocument.h"} = 1;
     
    852856           $type eq "Attr" or
    853857           $type eq "DocumentFragment") {
    854     # Add necessary includes
    855858    $implIncludes{"kjs_dom.h"} = 1;
    856859    $implIncludes{"Node.h"} = 1;
     
    858861    return "toJS(exec, $value)";
    859862  } elsif ($type eq "EventTarget") {
    860     # Add necessary includes
    861863    $implIncludes{"kjs_dom.h"} = 1;
    862864    $implIncludes{"EventTargetNode.h"} = 1;
    863865    return "toJS(exec, $value)";
    864866  } elsif ($type eq "NodeList" or $type eq "NamedNodeMap") {
    865     # Add necessary includes
    866867    $implIncludes{"kjs_dom.h"} = 1;
    867868    return "toJS(exec, $value)";
    868   } elsif ($type eq "CSSStyleSheet" or $type eq "StyleSheet") {
    869     # Add necessary includes
     869  } elsif ($type eq "CSSStyleSheet" or $type eq "StyleSheet" or $type eq "MediaList") {
    870870    $implIncludes{"css_stylesheetimpl.h"} = 1;
    871871    $implIncludes{"css_ruleimpl.h"} = 1;
    872872    $implIncludes{"kjs_css.h"} = 1;
    873873    return "toJS(exec, $value)";   
    874   } elsif ($type eq "CSSStyleDeclaration") {
    875     # Add necessary includes
     874  } elsif ($type eq "CSSStyleDeclaration" or $type eq "Counter" or $type eq "Rect") {
    876875    $implIncludes{"css_valueimpl.h"} = 1;
    877876    $implIncludes{"kjs_css.h"} = 1;
    878877    return "toJS(exec, $value)";
     878  } elsif ($type eq "RGBColor") {
     879    $implIncludes{"kjs_css.h"} = 1;
     880    return "getDOMRGBColor(exec, $value)";
    879881  } elsif ($type eq "HTMLCanvasElement") {
    880882    $implIncludes{"kjs_dom.h"} = 1;
  • trunk/WebCore/bridge/mac/FrameMac.h

    r13605 r13639  
    329329    void registerCommandForUndoOrRedo(const EditCommandPtr &cmd, bool isRedo);
    330330
    331     virtual void detachFromView();
    332 
    333331    WebCoreFrameBridge* _bridge;
    334332   
  • trunk/WebCore/bridge/mac/FrameMac.mm

    r13621 r13639  
    127127    , _windowScriptNPObject(0)
    128128{
    129     mutableInstances().prepend(this);
    130 
    131129    d->m_extension = new BrowserExtensionMac(this);
    132130}
     
    135133{
    136134    setView(0);
    137     mutableInstances().remove(this);
    138135    freeClipboard();
    139136    clearRecordedFormValues();   
     
    23562353                        maxMarkerWidth = MAX([font pointSize], maxMarkerWidth);
    23572354                        switch(style->listStyleType()) {
    2358                             case WebCore::DISC:
     2355                            case DISC:
    23592356                                listText += ((QChar)BULLET_CHAR);
    23602357                                break;
    2361                             case WebCore::CIRCLE:
     2358                            case CIRCLE:
    23622359                                listText += ((QChar)CIRCLE_CHAR);
    23632360                                break;
    2364                             case WebCore::SQUARE:
     2361                            case SQUARE:
    23652362                                listText += ((QChar)SQUARE_CHAR);
    23662363                                break;
    2367                             case WebCore::LNONE:
     2364                            case LNONE:
    23682365                                break;
    23692366                            default:
     
    27512748
    27522749    int decoration = style->textDecorationsInEffect();
    2753     if (decoration & WebCore::LINE_THROUGH)
     2750    if (decoration & LINE_THROUGH)
    27542751        [result setObject:[NSNumber numberWithInt:NSUnderlineStyleSingle] forKey:NSStrikethroughStyleAttributeName];
    27552752
    27562753    int superscriptInt = 0;
    27572754    switch (style->verticalAlign()) {
    2758         case WebCore::BASELINE:
    2759         case WebCore::BOTTOM:
    2760         case WebCore::BASELINE_MIDDLE:
    2761         case WebCore::LENGTH:
    2762         case WebCore::MIDDLE:
    2763         case WebCore::TEXT_BOTTOM:
    2764         case WebCore::TEXT_TOP:
    2765         case WebCore::TOP:
     2755        case BASELINE:
     2756        case BOTTOM:
     2757        case BASELINE_MIDDLE:
     2758        case LENGTH:
     2759        case MIDDLE:
     2760        case TEXT_BOTTOM:
     2761        case TEXT_TOP:
     2762        case TOP:
    27662763            break;
    2767         case WebCore::SUB:
     2764        case SUB:
    27682765            superscriptInt = -1;
    27692766            break;
    2770         case WebCore::SUPER:
     2767        case SUPER:
    27712768            superscriptInt = 1;
    27722769            break;
     
    27752772        [result setObject:[NSNumber numberWithInt:superscriptInt] forKey:NSSuperscriptAttributeName];
    27762773
    2777     if (decoration & WebCore::UNDERLINE)
     2774    if (decoration & UNDERLINE)
    27782775        [result setObject:[NSNumber numberWithInt:NSUnderlineStyleSingle] forKey:NSUnderlineStyleAttributeName];
    27792776
     
    28002797       
    28012798    switch (style->direction()) {
    2802         case WebCore::LTR:
     2799        case LTR:
    28032800            result = NSWritingDirectionLeftToRight;
    28042801            break;
    2805         case WebCore::RTL:
     2802        case RTL:
    28062803            result = NSWritingDirectionRightToLeft;
    28072804            break;
     
    28732870}
    28742871
    2875 void FrameMac::didTellBridgeAboutLoad(const WebCore::String& URL)
     2872void FrameMac::didTellBridgeAboutLoad(const String& URL)
    28762873{
    28772874    urlsBridgeKnowsAbout.add(URL.impl());
    28782875}
    28792876
    2880 bool FrameMac::haveToldBridgeAboutLoad(const WebCore::String& URL)
     2877bool FrameMac::haveToldBridgeAboutLoad(const String& URL)
    28812878{
    28822879    return urlsBridgeKnowsAbout.contains(URL.impl());
     
    31493146}
    31503147
    3151 bool FrameMac::shouldChangeSelection(const SelectionController &oldSelection, const SelectionController &newSelection, WebCore::EAffinity affinity, bool stillSelecting) const
     3148bool FrameMac::shouldChangeSelection(const SelectionController &oldSelection, const SelectionController &newSelection, EAffinity affinity, bool stillSelecting) const
    31523149{
    31533150    return [_bridge shouldChangeSelectedDOMRange:[DOMRange _rangeWith:oldSelection.toRange().get()]
     
    33723369}
    33733370
    3374 void FrameMac::detachFromView()
    3375 {
    3376     setView(0);
    3377 }
    3378 
    3379 }
     3371void Frame::setNeedsReapplyStyles()
     3372{
     3373    [Mac(this)->bridge() setNeedsReapplyStyles];
     3374}
     3375
     3376}
  • trunk/WebCore/bridge/mac/WebCoreSettings.mm

    r13440 r13639  
    11/*
    2  * Copyright (C) 2004 Apple Computer, Inc.  All rights reserved.
     2 * Copyright (C) 2004, 2006 Apple Computer, Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #include "config.h"
     26#import "config.h"
    2727#import "WebCoreSettings.h"
    2828
    2929#import "FoundationExtras.h"
    30 #import "FrameMac.h"
    3130#import "KWQKHTMLSettings.h"
     31#import "Page.h"
    3232#import "WebCoreFrameBridge.h"
    3333
     
    6262    // A Frame may not have been created yet, so we initialize the AtomicString hash before we try and use it in KHTMLSettings.
    6363    AtomicString::init();
    64     settings = new KHTMLSettings();
     64    settings = new KHTMLSettings;
    6565    return [super init];
    6666}
     
    6868- (void)_updateAllViews
    6969{
    70     for (DeprecatedPtrListIterator<Frame> it(Frame::instances()); it.current(); ++it) {
    71         FrameMac *frame = Mac(it.current());
    72         if (frame->settings() == settings)
    73             [frame->bridge() setNeedsReapplyStyles];
    74     }
     70    Page::setNeedsReapplyStylesForSettingsChange(settings);
    7571}
    7672
  • trunk/WebCore/css/CSSValueKeywords.in

    r13581 r13639  
    151151windowframe
    152152windowtext
     153-webkit-focus-ring-color
    153154#
    154155# colors in non strict mode
  • trunk/WebCore/css/cssparser.cpp

    r13581 r13639  
    4444extern int cssyyparse(void* parser);
    4545
     46using namespace std;
     47
    4648namespace WebCore {
    4749
     
    570572        /* nobreak */
    571573    case CSS_PROP_OUTLINE_COLOR:        // <color> | invert | inherit
    572         // outline has "invert" as additional keyword.
    573         if (propId == CSS_PROP_OUTLINE_COLOR && id == CSS_VAL_INVERT) {
     574        // Outline color has "invert" as additional keyword.
     575        // Also, we want to allow the special focus color even in strict parsing mode.
     576        if (propId == CSS_PROP_OUTLINE_COLOR && (id == CSS_VAL_INVERT || id == CSS_VAL__WEBKIT_FOCUS_RING_COLOR)) {
    574577            valid_primitive = true;
    575578            break;
     
    589592                                    // since we use this in our UA sheets.
    590593        else if (id >= CSS_VAL_AQUA && id <= CSS_VAL_WINDOWTEXT || id == CSS_VAL_MENU ||
    591              (id >= CSS_VAL_GREY && id < CSS_VAL__KHTML_TEXT && !strict)) {
     594             (id >= CSS_VAL__WEBKIT_FOCUS_RING_COLOR && id < CSS_VAL__KHTML_TEXT && !strict)) {
    592595            valid_primitive = true;
    593596        } else {
     
    20632066bool CSSParser::parseColor(const DeprecatedString &name, RGBA32& rgb)
    20642067{
     2068    // FIXME: Should we move this stuff about hex digits without a "#" prefix
     2069    // into the Color class along with the "#"-prefix version?
     2070
    20652071    int len = name.length();
    20662072
     
    21422148            return 0;
    21432149        int b = (int) (v->fValue * (v->unit == CSSPrimitiveValue::CSS_PERCENTAGE ? 256./100. : 1.));
    2144         r = kMax(0, kMin(255, r));
    2145         g = kMax(0, kMin(255, g));
    2146         b = kMax(0, kMin(255, b));
    21472150        c = makeRGB(r, g, b);
    21482151    }
     
    21762179        if (!validUnit(v, FNumber, true))
    21772180            return 0;
    2178         r = kMax(0, kMin(255, r));
    2179         g = kMax(0, kMin(255, g));
    2180         b = kMax(0, kMin(255, b));
    2181         int a = (int)(kMax(0.0, kMin(1.0, v->fValue)) * 255);
     2181        int a = (int)(max(0.0, min(1.0, v->fValue)) * 255);
    21822182        c = makeRGBA(r, g, b, a);
    21832183    }
     
    22942294            CSSPrimitiveValue* parsedColor = 0;
    22952295            bool isColor = (val->id >= CSS_VAL_AQUA && val->id <= CSS_VAL_WINDOWTEXT || val->id == CSS_VAL_MENU ||
    2296                             (val->id >= CSS_VAL_GREY && val->id <= CSS_VAL__KHTML_TEXT && !strict));
     2296                            (val->id >= CSS_VAL__WEBKIT_FOCUS_RING_COLOR && val->id <= CSS_VAL__KHTML_TEXT && !strict));
    22972297            if (isColor) {
    22982298                if (!context.allowColor)
  • trunk/WebCore/css/cssstyleselector.cpp

    r13553 r13639  
    277277}
    278278
    279 static CSSStyleSheet* parseUASheet(const unsigned short* characters, int size)
     279static CSSStyleSheet* parseUASheet(const char* characters, unsigned size)
    280280{
    281281    CSSStyleSheet* const parent = 0;
    282282    CSSStyleSheet* sheet = new CSSStyleSheet(parent);
    283283    sheet->ref(); // leak the sheet on purpose since it will be stored in a global variable
    284     sheet->parseString(String(reinterpret_cast<const QChar*>(characters), size));
     284    sheet->parseString(String(characters, size));
    285285    return sheet;
    286286}
     
    288288template<typename T> CSSStyleSheet* parseUASheet(const T& array)
    289289{
    290     return parseUASheet(array, sizeof(array) / sizeof(unsigned short));
     290    return parseUASheet(array, sizeof(array));
    291291}
    292292
     
    16371637    }
    16381638    return l;
    1639 }
    1640 
    1641 
    1642 // color mapping code
    1643 struct colorMap {
    1644     int css_value;
    1645     RGBA32 color;
    1646 };
    1647 
    1648 static const colorMap cmap[] = {
    1649     { CSS_VAL_AQUA, 0xFF00FFFF },
    1650     { CSS_VAL_BLACK, 0xFF000000 },
    1651     { CSS_VAL_BLUE, 0xFF0000FF },
    1652     { CSS_VAL_FUCHSIA, 0xFFFF00FF },
    1653     { CSS_VAL_GRAY, 0xFF808080 },
    1654     { CSS_VAL_GREEN, 0xFF008000  },
    1655     { CSS_VAL_LIME, 0xFF00FF00 },
    1656     { CSS_VAL_MAROON, 0xFF800000 },
    1657     { CSS_VAL_NAVY, 0xFF000080 },
    1658     { CSS_VAL_OLIVE, 0xFF808000  },
    1659     { CSS_VAL_ORANGE, 0xFFFFA500 },
    1660     { CSS_VAL_PURPLE, 0xFF800080 },
    1661     { CSS_VAL_RED, 0xFFFF0000 },
    1662     { CSS_VAL_SILVER, 0xFFC0C0C0 },
    1663     { CSS_VAL_TEAL, 0xFF008080  },
    1664     { CSS_VAL_WHITE, 0xFFFFFFFF },
    1665     { CSS_VAL_YELLOW, 0xFFFFFF00 },
    1666     { CSS_VAL_TRANSPARENT, Color::transparent },
    1667     { CSS_VAL_GREY, 0xFF808080 },
    1668     { CSS_VAL_ACTIVEBORDER, 0xFFE0E0E0 },
    1669     { CSS_VAL_ACTIVECAPTION, 0xFF000000 },
    1670     { CSS_VAL_APPWORKSPACE, 0xFF000000 },
    1671     { CSS_VAL_BUTTONFACE, 0xFFC0C0C0 },
    1672     { CSS_VAL_BUTTONHIGHLIGHT, 0xFFE0E0E0 },
    1673     { CSS_VAL_BUTTONSHADOW, 0xFFFFFFFF },
    1674     { CSS_VAL_BUTTONTEXT, 0xFF000000 },
    1675     { CSS_VAL_CAPTIONTEXT, 0xFF000000 },
    1676     { CSS_VAL_GRAYTEXT, 0xFF808080 },
    1677     { CSS_VAL_HIGHLIGHT, 0xFFFFFFFF },
    1678     { CSS_VAL_HIGHLIGHTTEXT, 0xFFFFFFFF },
    1679     { CSS_VAL_INACTIVEBORDER, 0xFFFFFFFF },
    1680     { CSS_VAL_INACTIVECAPTION, 0xFFFFFFFF },
    1681     { CSS_VAL_INACTIVECAPTIONTEXT, 0xFF000000 },
    1682     { CSS_VAL_INFOBACKGROUND, 0xFF000000 },
    1683     { CSS_VAL_INFOTEXT, 0xFF000000 },
    1684     { CSS_VAL_MENU, 0xFFFFFFFF },
    1685     { CSS_VAL_MENUTEXT, 0xFFFFFFFF },
    1686     { CSS_VAL_SCROLLBAR, 0xFFFFFFFF },
    1687     { CSS_VAL_TEXT, 0xFF000000 },
    1688     { CSS_VAL_THREEDDARKSHADOW, 0xFF404040 },
    1689     { CSS_VAL_THREEDFACE, 0xFFC0C0C0 },
    1690     { CSS_VAL_THREEDHIGHLIGHT, 0xFFE0E0E0 },
    1691     { CSS_VAL_THREEDLIGHTSHADOW, 0xFFC0C0C0 },
    1692     { CSS_VAL_THREEDSHADOW, 0xFFFFFFFF },
    1693     { CSS_VAL_WINDOW, 0xFFFFFFFF },
    1694     { CSS_VAL_WINDOWFRAME, 0xFFFFFFFF },
    1695     { CSS_VAL_WINDOWTEXT, 0xFF000000 },
    1696     { 0, 0 }
    1697 };
    1698 
    1699 
    1700 static Color colorForCSSValue(int css_value)
    1701 {
    1702     // try the regular ones first
    1703     const colorMap *col = cmap;
    1704     while (col->css_value && col->css_value != css_value)
    1705         ++col;
    1706     if (col->css_value)
    1707         return col->color;
    1708 
    1709     return Color();
    17101639}
    17111640
     
    23382267            return;
    23392268        }
    2340         else if (isInitial) {
     2269        if (isInitial) {
    23412270            // The border/outline colors will just map to the invalid color |col| above.  This will have the
    23422271            // effect of forcing the use of the currentColor when it comes time to draw the borders (and of
     
    23442273            if (id == CSS_PROP_COLOR)
    23452274                col = RenderStyle::initialColor();
    2346         }
    2347         else {
    2348             if(!primitiveValue)
     2275        } else {
     2276            if (!primitiveValue)
    23492277                return;
    23502278            col = getColorFromPrimitiveValue(primitiveValue);
    23512279        }
    23522280
    2353         switch(id)
    2354         {
     2281        switch(id) {
    23552282        case CSS_PROP_BACKGROUND_COLOR:
    23562283            style->setBackgroundColor(col); break;
     
    23672294        case CSS_PROP_OUTLINE_COLOR:
    23682295            style->setOutlineColor(col); break;
    2369         default:
    2370             return;
    23712296        }
    23722297        return;
     
    35053430    }
    35063431
    3507     case CSS_PROP_OUTLINE_OFFSET: {
     3432    case CSS_PROP_OUTLINE_OFFSET:
    35083433        HANDLE_INHERIT_AND_INITIAL(outlineOffset, OutlineOffset)
    3509 
    3510         int offset = primitiveValue->computeIntLength(style);
    3511         if (offset < 0) return;
    3512        
    3513         style->setOutlineOffset(offset);
    3514         break;
    3515     }
     3434        style->setOutlineOffset(primitiveValue->computeIntLength(style));
     3435        break;
    35163436
    35173437    case CSS_PROP_TEXT_SHADOW: {
     
    35203440            return;
    35213441        }
    3522         else if (isInitial) {
     3442        if (isInitial) {
    35233443            style->setTextShadow(0);
    35243444            return;
     
    35293449            return;
    35303450        }
    3531        
    3532         if (!value->isValueList()) return;
     3451
     3452        if (!value->isValueList())
     3453            return;
    35333454        CSSValueList *list = static_cast<CSSValueList *>(value);
    35343455        int len = list->length();
    35353456        for (int i = 0; i < len; i++) {
    35363457            ShadowValue *item = static_cast<ShadowValue*>(list->item(i));
    3537 
    35383458            int x = item->x->computeIntLength(style);
    35393459            int y = item->y->computeIntLength(style);
    35403460            int blur = item->blur ? item->blur->computeIntLength(style) : 0;
    3541             Color col = Color::transparent;
    3542             if (item->color) {
    3543                 int ident = item->color->getIdent();
    3544                 if (ident)
    3545                     col = colorForCSSValue(ident);
    3546                 else if (item->color->primitiveType() == CSSPrimitiveValue::CSS_RGBCOLOR)
    3547                     col.setRgb(item->color->getRGBColorValue());
    3548             }
    3549             ShadowData* shadowData = new ShadowData(x, y, blur, col);
     3461            Color color;
     3462            if (item->color)
     3463                color = getColorFromPrimitiveValue(item->color.get());
     3464            ShadowData* shadowData = new ShadowData(x, y, blur, color.isValid() ? color : Color::transparent);
    35503465            style->setTextShadow(shadowData, i != 0);
    35513466        }
    3552 
    35533467        return;
    35543468    }
     
    35573471        if (!primitiveValue || primitiveValue->primitiveType() != CSSPrimitiveValue::CSS_NUMBER)
    35583472            return; // Error case.
    3559        
    35603473        // Clamp opacity to the range 0-1
    35613474        style->setOpacity(kMin(1.0, kMax(0.0, primitiveValue->getFloatValue(CSSPrimitiveValue::CSS_NUMBER))));
     
    42394152}
    42404153
     4154// color mapping code
     4155struct ColorValue {
     4156    int css_value;
     4157    RGBA32 color;
     4158};
     4159
     4160static const ColorValue colorValues[] = {
     4161    { CSS_VAL_AQUA, 0xFF00FFFF },
     4162    { CSS_VAL_BLACK, 0xFF000000 },
     4163    { CSS_VAL_BLUE, 0xFF0000FF },
     4164    { CSS_VAL_FUCHSIA, 0xFFFF00FF },
     4165    { CSS_VAL_GRAY, 0xFF808080 },
     4166    { CSS_VAL_GREEN, 0xFF008000  },
     4167    { CSS_VAL_LIME, 0xFF00FF00 },
     4168    { CSS_VAL_MAROON, 0xFF800000 },
     4169    { CSS_VAL_NAVY, 0xFF000080 },
     4170    { CSS_VAL_OLIVE, 0xFF808000  },
     4171    { CSS_VAL_ORANGE, 0xFFFFA500 },
     4172    { CSS_VAL_PURPLE, 0xFF800080 },
     4173    { CSS_VAL_RED, 0xFFFF0000 },
     4174    { CSS_VAL_SILVER, 0xFFC0C0C0 },
     4175    { CSS_VAL_TEAL, 0xFF008080  },
     4176    { CSS_VAL_WHITE, 0xFFFFFFFF },
     4177    { CSS_VAL_YELLOW, 0xFFFFFF00 },
     4178    { CSS_VAL_TRANSPARENT, 0x00000000 },
     4179    { CSS_VAL_GREY, 0xFF808080 },
     4180    { CSS_VAL_ACTIVEBORDER, 0xFFE0E0E0 },
     4181    { CSS_VAL_ACTIVECAPTION, 0xFF000000 },
     4182    { CSS_VAL_APPWORKSPACE, 0xFF000000 },
     4183    { CSS_VAL_BUTTONFACE, 0xFFC0C0C0 },
     4184    { CSS_VAL_BUTTONHIGHLIGHT, 0xFFE0E0E0 },
     4185    { CSS_VAL_BUTTONSHADOW, 0xFFFFFFFF },
     4186    { CSS_VAL_BUTTONTEXT, 0xFF000000 },
     4187    { CSS_VAL_CAPTIONTEXT, 0xFF000000 },
     4188    { CSS_VAL_GRAYTEXT, 0xFF808080 },
     4189    { CSS_VAL_HIGHLIGHT, 0xFFFFFFFF },
     4190    { CSS_VAL_HIGHLIGHTTEXT, 0xFFFFFFFF },
     4191    { CSS_VAL_INACTIVEBORDER, 0xFFFFFFFF },
     4192    { CSS_VAL_INACTIVECAPTION, 0xFFFFFFFF },
     4193    { CSS_VAL_INACTIVECAPTIONTEXT, 0xFF000000 },
     4194    { CSS_VAL_INFOBACKGROUND, 0xFF000000 },
     4195    { CSS_VAL_INFOTEXT, 0xFF000000 },
     4196    { CSS_VAL_MENU, 0xFFFFFFFF },
     4197    { CSS_VAL_MENUTEXT, 0xFFFFFFFF },
     4198    { CSS_VAL_SCROLLBAR, 0xFFFFFFFF },
     4199    { CSS_VAL_TEXT, 0xFF000000 },
     4200    { CSS_VAL_THREEDDARKSHADOW, 0xFF404040 },
     4201    { CSS_VAL_THREEDFACE, 0xFFC0C0C0 },
     4202    { CSS_VAL_THREEDHIGHLIGHT, 0xFFE0E0E0 },
     4203    { CSS_VAL_THREEDLIGHTSHADOW, 0xFFC0C0C0 },
     4204    { CSS_VAL_THREEDSHADOW, 0xFFFFFFFF },
     4205    { CSS_VAL_WINDOW, 0xFFFFFFFF },
     4206    { CSS_VAL_WINDOWFRAME, 0xFFFFFFFF },
     4207    { CSS_VAL_WINDOWTEXT, 0xFF000000 },
     4208    { 0, 0 }
     4209};
     4210
     4211
     4212static Color colorForCSSValue(int css_value)
     4213{
     4214    for (const ColorValue* col = colorValues; col->css_value; ++col)
     4215        if (col->css_value == css_value)
     4216            return col->color;
     4217    return Color();
     4218}
     4219
    42414220Color CSSStyleSelector::getColorFromPrimitiveValue(CSSPrimitiveValue* primitiveValue)
    42424221{
     
    42564235                col = (pseudoState == PseudoLink) ? linkColor : visitedColor;
    42574236            }
    4258         }
    4259         else if (ident == CSS_VAL__KHTML_ACTIVELINK)
     4237        } else if (ident == CSS_VAL__KHTML_ACTIVELINK)
    42604238            col = element->document()->activeLinkColor();
     4239        else if (ident == CSS_VAL__WEBKIT_FOCUS_RING_COLOR)
     4240            col = focusRingColor();
    42614241        else
    42624242            col = colorForCSSValue(ident);
    42634243    } else if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_RGBCOLOR)
    42644244        col.setRgb(primitiveValue->getRGBColorValue());
    4265     return col;   
     4245    return col;
    42664246}
    42674247
  • trunk/WebCore/css/html4.css

    r13578 r13639  
    2626html {
    2727    display: block
    28 } 
     28}
    2929
    3030/* children of the <head> element all have display:none */
    31 head { 
    32     display: none
    33 }
    34      
     31head {
     32    display: none
     33}
     34
    3535meta {
    3636    display: none
     
    8181    display: block
    8282}
    83      
     83
    8484blockquote {
    8585    display: block;
     
    105105    /* special centering to be able to emulate the html4/netscape behaviour */
    106106    text-align: -khtml-center
    107 } 
     107}
    108108
    109109hr {
     
    119119
    120120/* heading elements */
    121      
     121
    122122h1 {
    123123    display: block;
     
    126126    font-weight: bold
    127127}
    128      
     128
    129129h2 {
    130130    display: block;
     
    133133    font-weight: bold
    134134}
    135      
     135
    136136h3 {
    137137    display: block;
     
    140140    font-weight: bold
    141141}
    142      
     142
    143143h4 {
    144144    display: block;
     
    181181    border-color: inherit
    182182}
    183      
     183
    184184tbody {
    185185    display: table-row-group;
    186     vertical-align: middle; 
     186    vertical-align: middle;
    187187    border-color: inherit
    188188}
    189      
     189
    190190tfoot {
    191191    display: table-footer-group;
     
    258258    display: block;
    259259    margin: 1__qem 0 1em 0
    260 } 
     260}
    261261
    262262dt {
     
    322322}
    323323
    324 input[type="password"], input[type="search"], input[type="hidden"], input[type="image"], input[type="file"]{
     324input[type="password"], input[type="search"], input[type="hidden"], input[type="image"], input[type="file"] {
    325325    -khtml-appearance: initial;
    326326    padding: initial;
     
    381381}
    382382
    383 /* inline elements */     
    384      
     383/* inline elements */
     384
    385385u, ins {
    386386    text-decoration: underline
    387387}
    388      
     388
    389389strong, b {
    390390    font-weight: bolder
    391391}
    392      
     392
    393393i, cite, em, var, address {
    394394    font-style: italic
    395395}
    396      
     396
    397397tt, code, kbd, samp {
    398398    font-family: monospace
    399399}
    400      
     400
    401401pre, xmp, plaintext, listing {
    402402    display: block;
     
    409409    font-size: larger
    410410}
    411      
     411
    412412small {
    413413    font-size: smaller
     
    439439
    440440:focus {
    441     outline: auto 3px #1f5ccf
     441    outline: auto 5px -webkit-focus-ring-color
    442442}
    443443
    444444html:focus, body:focus {
    445445    outline: none
     446}
     447
     448html:focus, body:focus {
     449    outline: none
     450}
     451 
     452input:focus {
     453    outline-offset: -2px
     454}
     455
     456input[type="button"]:focus,
     457input[type="checkbox"]:focus,
     458input[type="file"]:focus,
     459input[type="hidden"]:focus,
     460input[type="image"]:focus,
     461input[type="password"]:focus,
     462input[type="radio"]:focus,
     463input[type="reset"]:focus,
     464input[type="search"]:focus,
     465input[type="submit"]:focus {
     466    outline-offset: 0
    446467}
    447468
     
    466487}
    467488
    468 /* noscript is handled internally, as it depends on the html settings */
     489/* noscript is handled internally, as it depends on settings */
  • trunk/WebCore/css/make-css-file-arrays.pl

    r12293 r13639  
    4040
    4141    # Slurp in the CSS file.
    42     open IN, $in or die;
     42    open IN, "-|", "/usr/bin/cpp", "-P", $in, "-" or die;
    4343    my $text; { local $/; $text = <IN>; }
    4444    close IN;
     
    5757    # Write out a C array of the characters.
    5858    my $length = length $text;
    59     print HEADER "extern const unsigned short ${name}UserAgentStyleSheet[${length}];\n";
    60     print OUT "extern const unsigned short ${name}UserAgentStyleSheet[${length}] = {\n";
     59    print HEADER "extern const char ${name}UserAgentStyleSheet[${length}];\n";
     60    print OUT "extern const char ${name}UserAgentStyleSheet[${length}] = {\n";
    6161    my $i = 0;
    6262    while ($i < $length) {
  • trunk/WebCore/page/Frame.cpp

    r13605 r13639  
    28682868}
    28692869
    2870 DeprecatedPtrList<Frame>& Frame::mutableInstances()
    2871 {
    2872     static DeprecatedPtrList<Frame> instancesList;
    2873     return instancesList;
    2874 }
    2875 
    28762870void Frame::updatePolicyBaseURL()
    28772871{
     
    32653259}
    32663260
    3267 void Frame::detachFromView()
    3268 {
    3269 }
    3270 
    32713261KURL Frame::url() const
    32723262{
  • trunk/WebCore/page/Frame.h

    r13605 r13639  
    264264   * SVG and printing default style sheets.
    265265   */
    266   void setUserStyleSheetLocation(const KURL& url);
     266  void setUserStyleSheetLocation(const KURL&);
    267267  void setUserStyleSheet(const String& styleSheetData);
    268268 
     
    707707  static void clearDocumentFocus(Widget*);
    708708
    709   static const DeprecatedPtrList<Frame>& instances() { return mutableInstances(); }   
    710   static DeprecatedPtrList<Frame>& mutableInstances();
    711 
    712709  void updatePolicyBaseURL();
    713710  void setPolicyBaseURL(const String&);
     
    754751    void disconnectOwnerRenderer();
    755752
     753    void setNeedsReapplyStyles();
     754
    756755protected:
    757756    virtual void startRedirectionTimer();
     
    796795  virtual void frameDetached();
    797796
    798   virtual void detachFromView();
    799797  void updateBaseURLForEmptyDocument();
    800798
  • trunk/WebCore/page/FrameTree.cpp

    r13436 r13639  
    4949{
    5050    for (Frame* child = firstChild(); child; child = child->tree()->nextSibling())
    51         child->detachFromView();
     51        child->setView(0);
    5252}
    5353
     
    8383{
    8484    child->tree()->m_parent = 0;
    85     child->detachFromView();
     85    child->setView(0);
    8686
    8787    // Slightly tricky way to prevent deleting the child until we are done with it, w/o
  • trunk/WebCore/page/Page.cpp

    r13342 r13639  
    2222#include "Page.h"
    2323
     24#include "Color.h"
    2425#include "Frame.h"
     26#include "FrameTree.h"
    2527#include <kjs/collector.h>
    2628#include <kjs/JSLock.h>
    2729#include <kxmlcore/HashMap.h>
     30#include <kxmlcore/HashSet.h>
    2831
    2932using namespace KJS;
     
    3134namespace WebCore {
    3235
    33 static int pageCount;
     36static HashSet<Page*>* allPages;
    3437static HashMap<String, HashSet<Page*>*>* frameNamespaces;
    3538
    3639void Page::init()
    3740{
    38     ++pageCount;
     41    if (!allPages) {
     42        allPages = new HashSet<Page*>;
     43        setFocusRingColorChangeFunction(setNeedsReapplyStyles);
     44    }
     45    ASSERT(!allPages->contains(this));
     46    allPages->add(this);
    3947}
    4048
    41 Page::~Page() 
     49Page::~Page()
    4250{
    43     m_mainFrame->detachFromView();
     51    m_mainFrame->setView(0);
    4452    setGroupName(String());
    45     if (!--pageCount) {
     53    allPages->remove(this);
     54    if (allPages->isEmpty()) {
    4655        Frame::endAllLifeSupport();
    4756#ifndef NDEBUG
     
    94103}
    95104
     105void Page::setNeedsReapplyStyles()
     106{
     107    if (!allPages)
     108        return;
     109    HashSet<Page*>::iterator end = allPages->end();
     110    for (HashSet<Page*>::iterator it = allPages->begin(); it != end; ++it)
     111        for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext())
     112            frame->setNeedsReapplyStyles();
    96113}
     114
     115void Page::setNeedsReapplyStylesForSettingsChange(KHTMLSettings* settings)
     116{
     117    if (!allPages)
     118        return;
     119    HashSet<Page*>::iterator end = allPages->end();
     120    for (HashSet<Page*>::iterator it = allPages->begin(); it != end; ++it)
     121        for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext())
     122            if (frame->settings() == settings)
     123                frame->setNeedsReapplyStyles();
     124}
     125
     126}
  • trunk/WebCore/page/Page.h

    r13350 r13639  
    3636#endif
    3737
     38class KHTMLSettings;
     39
    3840namespace WebCore {
    3941
     
    6163        int frameCount() const { return m_frameCount; }
    6264
     65        static void setNeedsReapplyStyles();
     66        static void setNeedsReapplyStylesForSettingsChange(KHTMLSettings*);
     67
    6368#if __APPLE__
    6469        Page(WebCorePageBridge*);
  • trunk/WebCore/platform/Color.cpp

    r13532 r13639  
    3131#include <kxmlcore/Assertions.h>
    3232
    33 // Turn off inlining to avoid warning with newer gcc.
    34 #undef __inline
    35 #define __inline
    3633#include "ColorData.c"
    37 #undef __inline
     34
     35using namespace std;
    3836
    3937namespace WebCore {
     
    4139RGBA32 makeRGB(int r, int g, int b)
    4240{
    43     if (r < 0) r = 0; else if (r > 255) r = 255;
    44     if (g < 0) g = 0; else if (g > 255) g = 255;
    45     if (b < 0) b = 0; else if (b > 255) b = 255;
    46     return (r << 16 | g << 8 | b) | 0xFF000000;
     41    return 0xFF000000 | max(0, min(r, 255)) << 16 | max(0, min(g, 255)) << 8 | max(0, min(b, 255));
    4742}
    4843
    4944RGBA32 makeRGBA(int r, int g, int b, int a)
    5045{
    51     if (r < 0) r = 0; else if (r > 255) r = 255;
    52     if (g < 0) g = 0; else if (g > 255) g = 255;
    53     if (b < 0) b = 0; else if (b > 255) b = 255;
    54     if (a < 0) a = 0; else if (a > 255) a = 255;
    55     return (a << 24 | r << 16 | g << 8 | b);
    56 }
    57 
    58 // copied from css/cssparser.h
    59 static inline bool parseHexColor(const DeprecatedString &name, RGBA32 &rgb)
     46    return max(0, min(a, 255)) << 24 | max(0, min(r, 255)) << 16 | max(0, min(g, 255)) << 8 | max(0, min(b, 255));
     47}
     48
     49// originally moved here from the CSS parser
     50static inline bool parseHexColor(const String& name, RGBA32 &rgb)
    6051{
    6152    int len = name.length();
    62    
    63     if ( !len )
     53    if (!len)
    6454        return false;
    65     bool ok;
    66    
    67     if ( len == 3 || len == 6 ) {
    68         int val = name.toInt(&ok, 16);
    69         if ( ok ) {
     55
     56    if (len == 3 || len == 6) {
     57        bool ok;
     58        int val = name.deprecatedString().toInt(&ok, 16);
     59        if (ok) {
    7060            if (len == 6) {
    71                 rgb =  (0xff << 24) | val;
     61                rgb = (0xff << 24) | val;
    7262                return true;
    7363            }
    74             else if ( len == 3 ) {
     64            if (len == 3) {
    7565                // #abc converts to #aabbcc according to the specs
    76                 rgb = (0xff << 24) |
    77                 (val&0xf00)<<12 | (val&0xf00)<<8 |
    78                 (val&0xf0)<<8 | (val&0xf0)<<4 |
    79                 (val&0xf)<<4 | (val&0xf);
     66                rgb = (0xff << 24)
     67                    | (val & 0xf00) << 12 | (val & 0xf00) << 8
     68                    | (val & 0xf0) << 8 | (val & 0xf0) << 4
     69                    | (val & 0xf) << 4 | (val & 0xf);
    8070                return true;
    8171            }
     
    8575}
    8676
    87 Color::Color(const DeprecatedString &name) {
    88     if(name.startsWith("#")) {
    89         valid = parseHexColor(name.mid(1), color);
    90     } else {
    91         const NamedColor *foundColor = findColor(name.ascii(), name.length());
    92         color = foundColor ? foundColor->RGBValue : 0;
    93         color |= 0xFF000000;
    94         valid = foundColor;
    95     }
    96 }
    97 
    98 Color::Color(const char *name)
    99 {
    100     if(name[0] == '#') {
    101         valid = parseHexColor(DeprecatedString(name).mid(1), color);
    102     } else {
    103         const NamedColor *foundColor = findColor(name, strlen(name));
     77Color::Color(const String& name)
     78{
     79    if (name.startsWith("#"))
     80        valid = parseHexColor(name.substring(1), color);
     81    else
     82        setNamedColor(name);
     83}
     84
     85Color::Color(const char* name)
     86{
     87    if (name[0] == '#')
     88        valid = parseHexColor(&name[1], color);
     89    else {
     90        const NamedColor* foundColor = findColor(name, strlen(name));
    10491        color = foundColor ? foundColor->RGBValue : 0;
    10592        color |= 0xFF000000;
     
    118105}
    119106
    120 void Color::setNamedColor(const DeprecatedString &name)
    121 {
    122     const NamedColor *foundColor = name.isAllASCII() ? findColor(name.latin1(), name.length()) : 0;
     107void Color::setNamedColor(const String& name)
     108{
     109    DeprecatedString dname = name.deprecatedString();
     110    const NamedColor* foundColor = dname.isAllASCII() ? findColor(dname.latin1(), dname.length()) : 0;
    123111    color = foundColor ? foundColor->RGBValue : 0;
    124112    color |= 0xFF000000;
  • trunk/WebCore/platform/Color.h

    r13532 r13639  
    2727#define COLOR_H_
    2828
    29 class DeprecatedString;
     29#if __APPLE__
    3030
    31 #if __APPLE__
    3231#ifdef __OBJC__
    3332@class NSColor;
     
    3736
    3837typedef struct CGColor *CGColorRef;
     38
    3939#endif
    4040
     
    5454    Color(int r, int g, int b) : color(makeRGB(r, g, b)), valid(true) { }
    5555    Color(int r, int g, int b, int a) : color(makeRGBA(r, g, b, a)), valid(true) { }
    56     explicit Color(const DeprecatedString&);
    57     explicit Color(const char *);
     56    explicit Color(const String&);
     57    explicit Color(const char*);
    5858   
    5959    String name() const;
    60     void setNamedColor(const DeprecatedString&);
     60    void setNamedColor(const String&);
    6161
    6262    bool isValid() const { return valid; }
     
    6666    int blue() const { return color & 0xFF; }
    6767    int alpha() const { return (color >> 24) & 0xFF; }
    68     RGBA32 rgb() const { return color & 0xFFFFFFFF; } // Preserve the alpha.
     68    RGBA32 rgb() const { return color; } // Preserve the alpha.
    6969    void setRgb(int r, int g, int b) { color = makeRGB(r, g, b); valid = true; }
    70     void setRgb(int rgb) { color = rgb; valid = true; /* Alpha may be set. Preserve it. */ }
    71     void getRgbaF(float *, float *, float *, float *) const;
     70    void setRgb(RGBA32 rgb) { color = rgb; valid = true; }
     71    void getRgbaF(float*, float*, float*, float*) const;
    7272
    73     void hsv(int *, int *, int *) const;
     73    void hsv(int*, int*, int*) const;
    7474    void setHsv(int h, int s, int v);
    7575
    7676    Color light(int f = 150) const;
    7777    Color dark(int f = 200) const;
    78 
    79     friend bool operator==(const Color &a, const Color &b);
    80     friend bool operator!=(const Color &a, const Color &b);
    8178
    8279    static const RGBA32 black = 0xFF000000;
     
    9491inline bool operator==(const Color &a, const Color &b)
    9592{
    96     return a.color == b.color && a.valid == b.valid;
     93    return a.rgb() == b.rgb() && a.isValid() == b.isValid();
    9794}
    9895
    9996inline bool operator!=(const Color &a, const Color &b)
    10097{
    101     return a.color != b.color || a.valid != b.valid;
     98    return !(a == b);
    10299}
    103100
     101Color focusRingColor();
     102void setFocusRingColorChangeFunction(void (*)());
     103
    104104#if __APPLE__
    105 NSColor *nsColor(const Color &);
    106 CGColorRef cgColor(const Color &);
     105NSColor* nsColor(const Color&);
     106CGColorRef cgColor(const Color&);
    107107#endif
    108108
    109109}
    110110
    111 // FIXME: Remove usings when the rest of KWQ has been converted.
    112 using WebCore::RGBA32;
    113 using WebCore::Color;
    114 
    115111#endif
  • trunk/WebCore/platform/PlatformString.h

    r13532 r13639  
    5050    String(const KJS::UString&);
    5151    String(const char*);
     52    String(const char*, unsigned length);
    5253    String(StringImpl* i) : m_impl(i) { }
    5354
  • trunk/WebCore/platform/String.cpp

    r13574 r13639  
    6666}
    6767
     68String::String(const char* str, unsigned length)
     69{
     70    if (!str)
     71        return;
     72
     73    if (length == 0)
     74        m_impl = StringImpl::empty();
     75    else
     76        m_impl = new StringImpl(str, length);
     77}
     78
    6879String& String::operator+=(const String &str)
    6980{
  • trunk/WebCore/platform/mac/ColorMac.mm

    r13249 r13639  
    11/*
    2  * Copyright (C) 2003-6 Apple Computer, Inc.  All rights reserved.
     2 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #include "config.h"
     26#import "config.h"
    2727#import "Color.h"
     28
     29#import <kxmlcore/Assertions.h>
     30
     31@interface WebCoreControlTintObserver : NSObject
     32+ (void)controlTintDidChange;
     33@end
    2834
    2935namespace WebCore {
     
    3137// NSColor calls don't throw, so no need to block Cocoa exceptions in this file
    3238
    33 NSColor *nsColor(const Color &color)
     39static bool tintIsKnown;
     40static bool tintIsKnownToBeGraphite;
     41static void (*tintChangeFunction)();
     42
     43NSColor* nsColor(const Color& color)
    3444{
    3545    unsigned c = color.rgb();
     
    3747        case 0: {
    3848            // Need this to avoid returning nil because cachedRGBAValues will default to 0.
    39             static NSColor *clearColor = [[NSColor clearColor] retain];
     49            static NSColor* clearColor = [[NSColor clearColor] retain];
    4050            return clearColor;
    4151        }
    4252        case Color::black: {
    43             static NSColor *blackColor = [[NSColor blackColor] retain];
     53            static NSColor* blackColor = [[NSColor blackColor] retain];
    4454            return blackColor;
    4555        }
    4656        case Color::white: {
    47             static NSColor *whiteColor = [[NSColor whiteColor] retain];
     57            static NSColor* whiteColor = [[NSColor whiteColor] retain];
    4858            return whiteColor;
    4959        }
     
    5161            const int cacheSize = 32;
    5262            static unsigned cachedRGBAValues[cacheSize];
    53             static NSColor *cachedColors[cacheSize];
     63            static NSColor* cachedColors[cacheSize];
    5464
    55             for (int i = 0; i != cacheSize; ++i) {
    56                 if (cachedRGBAValues[i] == c) {
     65            for (int i = 0; i != cacheSize; ++i)
     66                if (cachedRGBAValues[i] == c)
    5767                    return cachedColors[i];
    58                 }
    59             }
    6068
    6169#if COLORMATCH_EVERYTHING
    62             NSColor *result = [NSColor colorWithCalibratedRed:color.red() / 255.0
     70            NSColor* result = [NSColor colorWithCalibratedRed:color.red() / 255.0
    6371                                                        green:color.green() / 255.0
    6472                                                         blue:color.blue() / 255.0
    6573                                                        alpha:color.alpha() /255.0];
    6674#else
    67             NSColor *result = [NSColor colorWithDeviceRed:color.red() / 255.0
     75            NSColor* result = [NSColor colorWithDeviceRed:color.red() / 255.0
    6876                                                    green:color.green() / 255.0
    6977                                                     blue:color.blue() / 255.0
     
    7583            [cachedColors[cursor] autorelease];
    7684            cachedColors[cursor] = [result retain];
    77             if (++cursor == cacheSize) {
     85            if (++cursor == cacheSize)
    7886                cursor = 0;
    79             }
    80 
    8187            return result;
    8288        }
     
    8490}
    8591
    86 static CGColorRef CGColorFromNSColor(NSColor *color)
     92static CGColorRef CGColorFromNSColor(NSColor* color)
    8793{
    88     // this needs to always use device colorspace so it can de-calibrate the color for
    89     // CGColor to possibly recalibrate it
     94    // This needs to always use device colorspace so it can de-calibrate the color for
     95    // CGColor to possibly recalibrate it.
    9096    NSColor* deviceColor = [color colorUsingColorSpaceName:NSDeviceRGBColorSpace];
    9197    float red = [deviceColor redComponent];
     
    9399    float blue = [deviceColor blueComponent];
    94100    float alpha = [deviceColor alphaComponent];
    95     const float components[] = { red, green, blue, alpha };
    96    
     101    const float components[4] = { red, green, blue, alpha };
    97102    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
    98103    CGColorRef cgColor = CGColorCreate(colorSpace, components);
     
    101106}
    102107
    103 CGColorRef cgColor(const Color &c)
     108CGColorRef cgColor(const Color& c)
    104109{
    105110    // We could directly create a CGColor here, but that would
    106     // skip any rgb caching the nsColor method does. A direct
    107     // creation should be investigated for a possible performance win.
     111    // skip any RGB caching the nsColor method does. A direct
     112    // creation could be investigated for a possible performance win.
    108113    return CGColorFromNSColor(nsColor(c));
    109114}
    110115
     116static void observeTint()
     117{
     118    ASSERT(!tintIsKnown);
     119    [[NSNotificationCenter defaultCenter] addObserver:[WebCoreControlTintObserver class]
     120                                             selector:@selector(controlTintDidChange)
     121                                                 name:NSControlTintDidChangeNotification
     122                                               object:NSApp];
     123    [WebCoreControlTintObserver controlTintDidChange];
     124    tintIsKnown = true;
    111125}
     126
     127void setFocusRingColorChangeFunction(void (*function)())
     128{
     129    ASSERT(!tintChangeFunction);
     130    tintChangeFunction = function;
     131    if (!tintIsKnown)
     132        observeTint();
     133}
     134
     135Color focusRingColor()
     136{
     137    if (!tintIsKnown)
     138        observeTint();
     139    return tintIsKnownToBeGraphite ? 0xFF9CABBD : 0xFF7DADD9;
     140}
     141
     142}
     143
     144@implementation WebCoreControlTintObserver
     145
     146+ (void)controlTintDidChange
     147{
     148    WebCore::tintIsKnownToBeGraphite = [NSColor currentControlTint] == NSGraphiteControlTint;
     149}
     150
     151@end
  • trunk/WebCore/platform/mac/WebCoreTextRendererFactory.mm

    r13393 r13639  
    11/*
    2  * Copyright (C) 2004 Apple Computer, Inc.  All rights reserved.
     2 * Copyright (C) 2004, 2006 Apple Computer, Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2727#import "WebCoreTextRendererFactory.h"
    2828
    29 #import <kxmlcore/Assertions.h>
    30 #import "FrameMac.h"
    3129#import "KWQListBox.h"
     30#import "Page.h"
    3231#import "WebCoreFrameBridge.h"
    3332#import "WebCoreTextRenderer.h"
     33#import <kxmlcore/Assertions.h>
    3434
    3535using namespace WebCore;
     
    116116{
    117117    QListBox::clearCachedTextRenderers();
    118     for (DeprecatedPtrListIterator<Frame> it(Frame::instances()); it.current(); ++it) {
    119         [Mac(it.current())->bridge() setNeedsReapplyStyles];
    120     }
     118    Page::setNeedsReapplyStyles();
    121119}
    122120
  • trunk/WebCore/rendering/render_style.h

    r13581 r13639  
    5858
    5959namespace WebCore {
     60
     61using std::max;
    6062
    6163class CSSStyleSelector;
     
    11571159    bool borderBottomIsTransparent() const { return surround->border.bottom.isTransparent(); }
    11581160   
    1159     unsigned short outlineSize() const { return outlineWidth() + outlineOffset(); }
    1160     unsigned short outlineWidth() const { if (background->m_outline.style() == BNONE || background->m_outline.style() == BHIDDEN) return 0; return background->m_outline.width; }
     1161    unsigned short outlineSize() const { return max(0, outlineWidth() + outlineOffset()); }
     1162    unsigned short outlineWidth() const {
     1163        if (background->m_outline.style() == BNONE || background->m_outline.style() == BHIDDEN)
     1164            return 0;
     1165        return background->m_outline.width;
     1166    }
    11611167    EBorderStyle   outlineStyle() const {  return background->m_outline.style(); }
    11621168    bool outlineStyleIsAuto() const { return background->m_outline._auto; }
     
    12841290#endif
    12851291    int outlineOffset() const {
    1286         if (background->m_outline.style() == BNONE || background->m_outline.style() == BHIDDEN) return 0; return background->m_outline._offset;
     1292        if (background->m_outline.style() == BNONE || background->m_outline.style() == BHIDDEN)
     1293            return 0;
     1294        return background->m_outline._offset;
    12871295    }
    12881296    ShadowData* textShadow() const { return css3InheritedData->textShadow; }
     
    15021510    void addBindingURI(StringImpl* uri);
    15031511#endif
    1504     void setOutlineOffset(unsigned short v) { SET_VAR(background, m_outline._offset, v) }
     1512    void setOutlineOffset(int v) { SET_VAR(background, m_outline._offset, v) }
    15051513    void setTextShadow(ShadowData* val, bool add=false);
    15061514    void setOpacity(float f) { SET_VAR(css3NonInheritedData, opacity, f); }
Note: See TracChangeset for help on using the changeset viewer.